Merge lp:~dave-cheney/juju-core/033-testing-mgo-panic into lp:~juju/juju-core/trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~dave-cheney/juju-core/033-testing-mgo-panic |
Merge into: | lp:~juju/juju-core/trunk |
Diff against target: |
138 lines (+23/-21) 4 files modified
environs/dummy/environs.go (+10/-8) state/ssh_test.go (+1/-1) testing/mgo.go (+9/-9) testing/mgo_test.go (+3/-3) |
To merge this branch: | bzr merge lp:~dave-cheney/juju-core/033-testing-mgo-panic |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
The Go Language Gophers | Pending | ||
Review via email: mp+132146@code.launchpad.net |
Description of the change
testing: prefer Assert over panic
Unmerged revisions
- 700. By Dave Cheney
-
pass C to MgoReset
- 699. By Dave Cheney
-
store: prefer c.Assert to panic
Updates #1073125.
Replace a bunch of panics with Asserts to make the underlying issue more obvious.
R=rog
CC=
https://codereview. appspot. com/6818053 - 698. By Dave Cheney
-
worker/provisioner: fix race on config reload
Bug #1064144 was cause by a race between the PA reloading it's config -or-
observing a change to the machines collection. This proposal adds an observer
that the tests can use to wait until the PA has ack'd the configuration
change.R=fwereade, niemeyer
CC=
https://codereview. appspot. com/6742049 - 697. By William Reade
-
state: drop obsolete relation lifecycle
drop:
* Relation.
EnsureDying
* Relation.EnsureDead
* State.RemoveRelation ...and use Relation.Destroy and RelationUnit.
LeaveScope instead throughout. R=niemeyer
CC=
https://codereview. appspot. com/6812047 - 696. By William Reade
-
state: Relation.Destroy
...and `juju remove-relation`, because it's trivial now that Destroy exists.
Points to note:
* Relation.
EnsureDying, Relation. EnsureDead, and State.RemoveRel ation are
now obsolete, and will be remove entirely in a followup CL; omitted here
due to volume of change.
* It's still called remove-relation, instead of destroy-relation + alias,
because it seems more sensible to fix remove-unit at the same time and it
also deserves a separate CL IMO.R=niemeyer
CC=
https://codereview. appspot. com/6783051 - 695. By Roger Peppe
-
worker/uniter: make logger predictable
The stdout pipe is closed too early by os/exec;
do the work ourselves to prevent this.R=dfc, niemeyer
CC=
https://codereview. appspot. com/6774050 - 694. By William Reade
-
juju:implement add-relation
R=niemeyer
CC=
https://codereview. appspot. com/6761044 - 693. By William Reade
-
upstart: use better Out value
We now use the same value for upstart conf Out fields as we do --log-file
params. No idea what I did to lead myself to think it didn't work...Also, made log file names more consistent (ie $kind-$name.log, with no
explicit "-agent")R=rog, niemeyer
CC=
https://codereview. appspot. com/6766051 - 692. By William Reade
-
uniter/charm: verify upgrade symlink overwrite
Verifies non-existence of lp:988115 in juju-core
R=niemeyer
CC=
https://codereview. appspot. com/6760046 - 691. By Frank Mueller
-
firewaller: integrated global mode
Firewaller now recognizes the global mode. It dies a
port usage counting usage counting and opens each
used port only once and closes it after the last using unit
has gone. The handling of ports in case of a restart has
been removed from this CL to a later one.
https:/ /codereview. appspot. com/6775079/ diff/1/ environs/ dummy/environs. go dummy/environs. go (right):
File environs/
https:/ /codereview. appspot. com/6775079/ diff/1/ environs/ dummy/environs. go#newcode30 dummy/environs. go:30: "time"
environs/
nice
https:/ /codereview. appspot. com/6775079/ diff/1/ environs/ dummy/environs. go#newcode173 dummy/environs. go:173: testing. MgoReset( new(gocheck. C))
environs/
this seems wrong. if we haven't got a gocheck.C, panic is the only
viable alternative. there's no guarantee that new(gocheck.C) gives us a
working *C value.
one possibility would be to change MgoReset to accept an interface that
implements Fatalf, and write an implementation here that turns Fatalf
into panic.
https:/ /codereview. appspot. com/6775079/ diff/1/ testing/ mgo.go
File testing/mgo.go (right):
https:/ /codereview. appspot. com/6775079/ diff/1/ testing/ mgo.go# newcode86
testing/mgo.go:86: panic("MgoSuite tests must be run with
MgoTestPackage")
if you're gonna prefer Assert over panic then calling Assert rather than
panic might be a good plan. but in general i think this all works ok,
and we can leave the panics alone.
https:/ /codereview. appspot. com/6775079/ diff/1/ testing/ mgo.go# newcode117
testing/mgo.go:117: panic(err)
ditto
https:/ /codereview. appspot. com/6775079/ diff/1/ testing/ mgo.go# newcode122
testing/mgo.go:122: panic(err)
ditto
https:/ /codereview. appspot. com/6775079/ diff/1/ testing/ mgo.go# newcode130 Errorf( "Cannot drop MongoDB database %v:
testing/mgo.go:130: panic(fmt.
%v", name, err))
ditto
https:/ /codereview. appspot. com/6775079/