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

Issue 10251047: state: some watcher testing consistency

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 10 months ago by fwereade
Modified:
10 years, 10 months ago
Reviewers:
mue, mp+170005, thumper
Visibility:
Public.

Description

state: some watcher testing consistency Not great -- especially the duplication in watcher_test.go -- but rather better than what was there before, I think. And I think I've killed all the crazy-table-style watcher tests now, so that's a bonus. https://code.launchpad.net/~fwereade/juju-core/state-watcher-testing-consistency/+merge/170005 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 8

Patch Set 2 : state: some watcher testing consistency #

Unified diffs Side-by-side diffs Delta from patch set Stats (+531 lines, -858 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/synctools.go View 1 1 chunk +1 line, -1 line 0 comments Download
M cmd/juju/synctools_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M state/machine_test.go View 1 3 chunks +87 lines, -157 lines 0 comments Download
M state/relationunit_test.go View 9 chunks +9 lines, -17 lines 0 comments Download
M state/service_test.go View 1 5 chunks +128 lines, -382 lines 0 comments Download
M state/state_test.go View 10 chunks +88 lines, -147 lines 0 comments Download
M state/unit_test.go View 1 6 chunks +52 lines, -153 lines 0 comments Download
A state/watcher_test.go View 1 1 chunk +163 lines, -0 lines 0 comments Download

Messages

Total messages: 4
fwereade
Please take a look.
10 years, 10 months ago (2013-06-18 07:20:53 UTC) #1
mue
LGTM, great CL, makes much of the code clearer. https://codereview.appspot.com/10251047/diff/1/state/machine_test.go File state/machine_test.go (right): https://codereview.appspot.com/10251047/diff/1/state/machine_test.go#newcode505 state/machine_test.go:505: ...
10 years, 10 months ago (2013-06-18 07:43:52 UTC) #2
thumper
LGTM - just a few comments. https://codereview.appspot.com/10251047/diff/1/state/watcher_test.go File state/watcher_test.go (right): https://codereview.appspot.com/10251047/diff/1/state/watcher_test.go#newcode32 state/watcher_test.go:32: type NotifyWatcherC struct ...
10 years, 10 months ago (2013-06-18 23:19:58 UTC) #3
fwereade
10 years, 10 months ago (2013-06-19 09:59:51 UTC) #4
Please take a look.

https://codereview.appspot.com/10251047/diff/1/state/machine_test.go
File state/machine_test.go (right):

https://codereview.appspot.com/10251047/diff/1/state/machine_test.go#newcode505
state/machine_test.go:505: var watchMachineTests = []func(m *state.Machine)
error{
On 2013/06/18 07:43:52, mue wrote:
> Seems not to be used anymore.

Done.

https://codereview.appspot.com/10251047/diff/1/state/watcher_test.go
File state/watcher_test.go (right):

https://codereview.appspot.com/10251047/diff/1/state/watcher_test.go#newcode32
state/watcher_test.go:32: type NotifyWatcherC struct {
On 2013/06/18 23:19:59, thumper wrote:
> Not sure what I think of the name.
> 
> What about NotifyWatcherHelper?  The "C" is weird.

The "C" echoes with the gocheck.C it embeds; no comment re global weirdness, but
I think it's appropriate in context. Comments tweaked.

https://codereview.appspot.com/10251047/diff/1/state/watcher_test.go#newcode39
state/watcher_test.go:39: c.state.StartSync()
On 2013/06/18 23:19:59, thumper wrote:
> why is this one StartSync, and the one below Sync?

This is StartSync because we're not really expecting an event, and we can't be
bothered to wait for the backend to churn through everything and deliver the
absolute latest updates.

The Sync below is because we *do* generally want multiple backend events to have
been handled and coalesced; by waiting until they're all delivered to the
watcher we're testing, we ensure that by the time the watcher's ready to send
its own event it will have seen and incorporated [0] all necessary input.

[0] certain watchers themselves collate events from multiple watchers, and so
this guarantee doesn't actually apply; an intransigent scheduler could thus
cause this to go wrong. If and when this becomes a problem in practice, it'd be
possible to write an assert that collects events until the set of them
definitively matches, or does not match, expectations; but I'm not doing this
just yet.
Sign in to reply to this message.

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