Merge lp:~niemeyer/juju-core/fix-jujud-tests into lp:~juju/juju-core/trunk
Proposed by
Gustavo Niemeyer
Status: | Merged |
---|---|
Merged at revision: | 583 |
Proposed branch: | lp:~niemeyer/juju-core/fix-jujud-tests |
Merge into: | lp:~juju/juju-core/trunk |
Diff against target: |
196 lines (+27/-29) 3 files modified
cmd/jujud/provisioning_test.go (+10/-5) cmd/jujud/unit_test.go (+3/-0) cmd/jujud/upgrade_test.go (+14/-24) |
To merge this branch: | bzr merge lp:~niemeyer/juju-core/fix-jujud-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
The Go Language Gophers | Pending | ||
Review via email: mp+126536@code.launchpad.net |
Description of the change
cmd/jujud: fix all tests
To post a comment you must log in.
Reviewers: mp+126536_ code.launchpad. net,
Message:
Please take a look.
Description:
cmd/jujud: fix all tests
https:/ /code.launchpad .net/~niemeyer/ juju-core/ fix-jujud- tests/+ merge/126536
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6565052/
Affected files: provisioning_ test.go unit_test. go upgrade_ test.go
A [revision details]
M cmd/jujud/
M cmd/jujud/
M cmd/jujud/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: cmd/jujud/ provisioning_ test.go provisioning_ test.go' provisioning_ test.go 2012-09-25 23:40:11 +0000 provisioning_ test.go 2012-09-26 20:11:21 +0000 net/juju- core/cmd" net/juju- core/environs/ dummy" net/juju- core/juju/ testing" net/juju- core/state" AddUnits( svc, 1) opRecvTimeout( c, op, dummy.OpStartIn stance{ }), NotNil) s.opRecvTimeout (c, op, dummy.OpStartIn stance{ }), NotNil)
=== modified file 'cmd/jujud/
--- cmd/jujud/
+++ cmd/jujud/
@@ -5,6 +5,7 @@
"launchpad.
"launchpad.
"launchpad.
+ "launchpad.
"reflect"
"time"
)
@@ -56,7 +57,7 @@
c.Assert(err, IsNil)
units, err := s.Conn.
c.Assert(err, IsNil)
- c.Check(
+ c.Check(
// Wait for the instance id to show up in the state. .AssignedMachin eId() d(err) { .OpenPort( "tcp", 999)
id, err := units[0]
@@ -64,7 +65,10 @@
m, err := s.State.Machine(id)
c.Assert(err, IsNil)
w := m.Watch()
+ defer w.Stop()
for _ = range w.Changes() {
+ err = m.Refresh()
+ c.Assert(err, IsNil)
_, err := m.InstanceId()
if state.IsNotFoun
continue
@@ -75,7 +79,7 @@
err = units[0]
c.Assert(err, IsNil)
- c.Check( opRecvTimeout( c, op, dummy.OpOpenPor ts{}), NotNil) s.opRecvTimeout (c, op, dummy.OpOpenPor ts{}), NotNil)
+ c.Check(
err = a.Stop()
c.Assert(err, IsNil)
@@ -83,14 +87,15 @@
select {
case err := <-done:
c.Assert(err, IsNil)
- case <-time.After(2 * time.Second):
+ case <-time.After(5 * time.Second):
c.Fatalf("timed out waiting for agent to terminate")
}
}
// opRecvTimeout waits for any of the given kinds of operation to Logf("discardin g unknown event %#v", op)
// be received from ops, and times out if not.
-func opRecvTimeout(c *C, opc <-chan dummy.Operation,
kinds ...dummy.Operation) dummy.Operation {
+func (s *ProvisioningSuite) opRecvTimeout(c *C, opc <-chan
dummy.Operation, kinds ...dummy.Operation) dummy.Operation {
+ s.State.StartSync()
for {
select {
case op := <-opc:
@@ -100,7 +105,7 @@
}
}
c.
- case <-time.After(2 * time.Second):
+ case <-time.After(5 * time.Second):
c.Fatalf("time out wating for operation")
}
}
Index: cmd/jujud/ unit_test. go unit_test. go' unit_test. go 2012-09-13 20:32:50 +0000 unit_test. go 2012-09-26 19:39:30 +0000 Logf("started! ")
=== modified file 'cmd/jujud/
--- cmd/jujud/
+++ cmd/jujud/
@@ -96,6 +96,9 @@
continue
case state.UnitStarted:
c.
+ case state.UnitDown:
+ s.State.StartSync()
+ c.Logf("unit i...