Merge lp:~themue/juju-core/go-provisioning-test-fix into lp:~juju/juju-core/trunk

Proposed by Frank Mueller
Status: Work in progress
Proposed branch: lp:~themue/juju-core/go-provisioning-test-fix
Merge into: lp:~juju/juju-core/trunk
Diff against target: 38 lines (+16/-12)
1 file modified
cmd/jujud/provisioning_test.go (+16/-12)
To merge this branch: bzr merge lp:~themue/juju-core/go-provisioning-test-fix
Reviewer Review Type Date Requested Status
The Go Language Gophers Pending
Review via email: mp+119489@code.launchpad.net

Description of the change

provisioning: fixed a race condition in testing

The test if the provisioner and the firewaller are running
had a race condition. And additional test for nil prevents
this.

https://codereview.appspot.com/6462057/

To post a comment you must log in.
381. By Frank Mueller

provisioning: made the test fix a bit more safe

Revision history for this message
William Reade (fwereade) wrote :
Revision history for this message
Roger Peppe (rogpeppe) wrote :

https://codereview.appspot.com/6462057/diff/3001/cmd/jujud/provisioning_test.go
File cmd/jujud/provisioning_test.go (right):

https://codereview.appspot.com/6462057/diff/3001/cmd/jujud/provisioning_test.go#newcode20
cmd/jujud/provisioning_test.go:20: if p != nil && fw != nil {
I don't think this is sufficient, as discussed online. There is no
guarantee that this goroutine will see the changes made to the
ProvisioningAgent by the goroutine that called Run, as there's no
synchronisation between them.

https://codereview.appspot.com/6462057/

Unmerged revisions

381. By Frank Mueller

provisioning: made the test fix a bit more safe

380. By Frank Mueller

provisioning: fix race condition in test

379. By Dave Cheney

cmd/juju: add unexpose

Unexpose unexposes exposed services previously exposed with juju expose.

R=niemeyer
CC=
https://codereview.appspot.com/6450103

378. By Roger Peppe

jujutest: speed up live tests

There's no need for TestBootstrap to connect
to the state (the slowest part of the test), as
this is also tested in TestBootstrapProvisioner.

R=dfc, niemeyer
CC=
https://codereview.appspot.com/6442098

377. By Roger Peppe

worker/uniter: simplify EnsureTools and make it concurrent-safe

If someone breaks the symlinks, the user "gets everything they deserve".
Avoiding the link reading logic makes it trivial for EnsureTools
to be idempotent, even when run concurrently.

Also fix the agent name to match our upstart convention
which prefixes the tools directory with the agent kind.

R=fwereade, niemeyer
CC=
https://codereview.appspot.com/6461061

376. By William Reade

add uniter.EnsureTools

...which will write jujuc symlinks into the agent's tools dir for every
known hook command, and bail if it cannot do so for any reason.

R=niemeyer
CC=
https://codereview.appspot.com/6445089

375. By Dave Cheney

cmd/juju: add expose

Adds juju expose command, also normalises the format of
commadn descriptions (no capital letters, no trailing period).

R=fwereade, niemeyer
CC=
https://codereview.appspot.com/6458085

374. By Dave Cheney

cmd/juju: add add-unit command

add-unit adds units.

R=fwereade, rog, niemeyer
CC=
https://codereview.appspot.com/6449093

373. By William Reade

less spam

(help is only printed on --help, not on any cmd parse error)

R=niemeyer
CC=
https://codereview.appspot.com/6458094

372. By William Reade

add uniter.Relationer

This is a slightly unsatisfying type that emerged fairly naturally from a
sketch of a Uniter type that seemed to be going in a nice direction but
getting big. I don't think this type is complete yet (lifecycle handling
will, I think, force some reasonably significant changes, in time) but it
is a useful and self-contained chunk of functionality and IMO worth the
propose.

Better name suggestions would be appreciated, though.

R=dfc, niemeyer
CC=
https://codereview.appspot.com/6442088

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/jujud/provisioning_test.go'
2--- cmd/jujud/provisioning_test.go 2012-08-07 09:46:39 +0000
3+++ cmd/jujud/provisioning_test.go 2012-08-14 09:18:03 +0000
4@@ -15,18 +15,22 @@
5 start := time.Now()
6 for time.Since(start) < 500*time.Millisecond {
7 time.Sleep(50 * time.Millisecond)
8- perr := a.provisioner.Err()
9- fwerr := a.firewaller.Err()
10- if alive {
11- // Provisioner and firewaller have to be alive.
12- if perr == tomb.ErrStillAlive && fwerr == tomb.ErrStillAlive {
13- return
14- }
15- } else {
16- // Provisioner and firewaller have to be stopped.
17- if perr != tomb.ErrStillAlive && fwerr != tomb.ErrStillAlive {
18- c.Succeed()
19- return
20+ p := a.provisioner
21+ fw := a.firewaller
22+ if p != nil && fw != nil {
23+ perr := p.Err()
24+ fwerr := fw.Err()
25+ if alive {
26+ // Provisioner and firewaller have to be alive.
27+ if perr == tomb.ErrStillAlive && fwerr == tomb.ErrStillAlive {
28+ return
29+ }
30+ } else {
31+ // Provisioner and firewaller have to be stopped.
32+ if perr != tomb.ErrStillAlive && fwerr != tomb.ErrStillAlive {
33+ c.Succeed()
34+ return
35+ }
36 }
37 }
38 }

Subscribers

People subscribed via source and target branches