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

Issue 6566066: state,worker: full lifecycle machines watcher

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

Description

state,worker: full lifecycle machines watcher MachinesWatcher now returns a list of ids that have had their lifecycle changed in any way. It's up to the consumer to work out details. https://code.launchpad.net/~niemeyer/juju-core/full-lifecycle-machines-watcher/+merge/126825 Requires: https://code.launchpad.net/~themue/juju-core/go-firewaller-remove-tests-unit-service/+merge/126651 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 12

Patch Set 2 : state,worker: full lifecycle machines watcher #

Patch Set 3 : state,worker: full lifecycle machines watcher #

Unified diffs Side-by-side diffs Delta from patch set Stats (+308 lines, -170 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M state/state_test.go View 1 2 7 chunks +98 lines, -56 lines 0 comments Download
M state/watcher.go View 1 5 chunks +58 lines, -67 lines 0 comments Download
M worker/firewaller/firewaller.go View 5 chunks +47 lines, -12 lines 0 comments Download
M worker/firewaller/firewaller_test.go View 1 2 1 chunk +64 lines, -0 lines 0 comments Download
M worker/provisioner/provisioner.go View 7 chunks +39 lines, -35 lines 0 comments Download

Messages

Total messages: 4
niemeyer
Please take a look.
11 years, 7 months ago (2012-09-27 23:32:40 UTC) #1
TheMue
LGTM, WatchPrincipalUnits() should later also be changed into unit names instead of units.
11 years, 7 months ago (2012-09-28 13:42:36 UTC) #2
aram
LGTM with the changes in the machines watcher test. Someone who knows more about the ...
11 years, 7 months ago (2012-09-28 13:51:00 UTC) #3
niemeyer
11 years, 7 months ago (2012-09-28 17:45:03 UTC) #4
*** Submitted:

state,worker: full lifecycle machines watcher

MachinesWatcher now returns a list of ids that have had their
lifecycle changed in any way. It's up to the consumer to work
out details.

R=TheMue, aram
CC=
https://codereview.appspot.com/6566066

https://codereview.appspot.com/6566066/diff/1/state/state_test.go
File state/state_test.go (right):

https://codereview.appspot.com/6566066/diff/1/state/state_test.go#newcode249
state/state_test.go:249: changes []int
On 2012/09/28 13:51:00, aram wrote:
> I'd still prefer separate {alive,dying,dead} fields here, even though the
> watcher returns a single []int because it makes it very easy in the function
> below to check that when we get an event, the lifecycle of the entity is
really
> what we expect it to be.

As we talked online, that doesn't sound necessary. This would be testing that
the code within the test itself is doing what it claims to be doing. E.g. if we
EnsureDead, we don't have to test that the machine is indeed dead, or we'd be
cross-testing that EnsureDead works rather than verifying the behavior of the
watcher, which is the goal here.

https://codereview.appspot.com/6566066/diff/1/state/state_test.go#newcode312
state/state_test.go:312: "Report non-Dead machines that are removed",
On 2012/09/28 13:51:00, aram wrote:
> s/non-Dead/Dead/?

Thanks, I've clarified. It's actually "previously known".

https://codereview.appspot.com/6566066/diff/1/state/state_test.go#newcode417
state/state_test.go:417: c.Assert(got, DeepEquals, test.changes)
On 2012/09/28 13:51:00, aram wrote:
> We should also check that the lifecycle of the entity is what we expect it to
be.

As mentioned above, the test itself is the one enforcing the  lifecycle. This
would test the test, which at least here sounds unnecessary. We're verifying the
watcher behavior itself, given the changes performed by the test, which should
be working unless portions unrelated to the watcher are broken.

https://codereview.appspot.com/6566066/diff/1/state/watcher.go
File state/watcher.go (right):

https://codereview.appspot.com/6566066/diff/1/state/watcher.go#newcode174
state/watcher.go:174: type machineLifeDoc struct {
On 2012/09/28 13:51:00, aram wrote:
> I pondered about this. If we use Select anyway, why don't we use the real
> document, machineDoc in this case, and ignore the fields we don't care about?

I was on the fence on this one, but you're right. I've changed to use machineDoc
as suggested.

https://codereview.appspot.com/6566066/diff/1/state/watcher.go#newcode223
state/watcher.go:223: return ids, nil
On 2012/09/28 13:51:00, aram wrote:
> Interesting, so it's fine not to add it at the end, to preserve apparent order
> of events?

Yeah, it's certainly fine. We don't have guarantees of ordering from the
underlying watcher, and we don't offer those guarantees *within a single event*
upstream either.

Of course, it's not reasonable to report that a machine/unit/whatever is Alive
after it was found Dead.
Sign in to reply to this message.

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