Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2432)

Issue 6476044: mstate: changed lifecycle implementation in unit (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 8 months ago by TheMue
Modified:
11 years, 8 months ago
Reviewers:
mp+120744
Visibility:
Public.

Description

mstate: changed lifecycle implementation in unit Unit now has Life(), Kill() and Die() and uses the utility function ensureLife(). The test for removing a unit has been changed. https://code.launchpad.net/~themue/juju-core/go-mstate-unit-lifecycle/+merge/120744 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 13

Patch Set 2 : mstate: changed lifecycle implementation in unit #

Total comments: 10

Patch Set 3 : mstate: changed lifecycle implementation in unit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+71 lines, -6 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M mstate/service.go View 1 2 1 chunk +8 lines, -6 lines 0 comments Download
M mstate/service_test.go View 1 2 2 chunks +11 lines, -0 lines 0 comments Download
M mstate/state.go View 1 2 1 chunk +23 lines, -0 lines 0 comments Download
M mstate/unit.go View 1 2 1 chunk +27 lines, -0 lines 0 comments Download

Messages

Total messages: 7
TheMue
Please take a look.
11 years, 8 months ago (2012-08-22 10:37:12 UTC) #1
aram
Thanks for this. I don't see any lifecycle tests though. Could you add some? A ...
11 years, 8 months ago (2012-08-22 11:29:57 UTC) #2
TheMue
Please take a look. https://codereview.appspot.com/6476044/diff/1/mstate/service.go File mstate/service.go (right): https://codereview.appspot.com/6476044/diff/1/mstate/service.go#newcode174 mstate/service.go:174: {"_id", u.doc.Name}, On 2012/08/22 11:29:58, ...
11 years, 8 months ago (2012-08-22 11:49:33 UTC) #3
aram
Thanks, I still want a comprehensive test that uses the stateChanges table, like TestLifecycleStateChanges does. ...
11 years, 8 months ago (2012-08-22 11:57:22 UTC) #4
aram
> I still want a comprehensive test that uses the stateChanges table, like > TestLifecycleStateChanges ...
11 years, 8 months ago (2012-08-22 14:49:50 UTC) #5
niemeyer
There are missing tests, but I've seen Aram commenting that you're doing them in a ...
11 years, 8 months ago (2012-08-23 22:49:15 UTC) #6
TheMue
11 years, 8 months ago (2012-08-24 08:56:17 UTC) #7
*** Submitted:

mstate: changed lifecycle implementation in unit

Unit now has Life(), Kill() and Die() and uses the utility
function ensureLife(). The test for removing a unit has
been changed.

R=aram, niemeyer
CC=
https://codereview.appspot.com/6476044

https://codereview.appspot.com/6476044/diff/3002/mstate/service.go
File mstate/service.go (right):

https://codereview.appspot.com/6476044/diff/3002/mstate/service.go#newcode169
mstate/service.go:169: panic(fmt.Errorf("unit %q is not dead", u))
On 2012/08/23 22:49:15, niemeyer wrote:
> There's no reason to explode the world if there's an error like this. It's
> relatively easy to make that mistake, and it will not improve the situation
> further.

Done.

https://codereview.appspot.com/6476044/diff/3002/mstate/service.go#newcode178
mstate/service.go:178: return fmt.Errorf("cannot remove unit %q: %v",
u.doc.Name, err)
On 2012/08/23 22:49:15, niemeyer wrote:
> s/u.doc.Name/u/
> 
> The unit should have a proper String.

Done.

https://codereview.appspot.com/6476044/diff/3002/mstate/service_test.go
File mstate/service_test.go (right):

https://codereview.appspot.com/6476044/diff/3002/mstate/service_test.go#newco...
mstate/service_test.go:183: err = unit.Kill()
On 2012/08/23 22:49:15, niemeyer wrote:
> We can call Die directly, I believe.

Yes, discussed it already with Aram.

https://codereview.appspot.com/6476044/diff/3002/mstate/state.go
File mstate/state.go (right):

https://codereview.appspot.com/6476044/diff/3002/mstate/state.go#newcode59
mstate/state.go:59: return fmt.Errorf("cannot set life to %s for %s %q: %v",
life, descr, id, err)
On 2012/08/23 22:49:15, niemeyer wrote:
> s/life to %s/life to %q/

Done.

https://codereview.appspot.com/6476044/diff/3002/mstate/unit.go
File mstate/unit.go (right):

https://codereview.appspot.com/6476044/diff/3002/mstate/unit.go#newcode96
mstate/unit.go:96: // Life return the unit lifecycle.
On 2012/08/23 22:49:15, niemeyer wrote:
> // Life returns whether the unit is Alive, Dying or Dead.

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b