OLD | NEW |
1 package jujutest | 1 package jujutest |
2 | 2 |
3 import ( | 3 import ( |
4 "bytes" | 4 "bytes" |
5 "io" | 5 "io" |
6 "io/ioutil" | 6 "io/ioutil" |
7 . "launchpad.net/gocheck" | 7 . "launchpad.net/gocheck" |
8 "launchpad.net/juju-core/juju/environs" | 8 "launchpad.net/juju-core/juju/environs" |
9 "net/http" | 9 "net/http" |
10 "time" | 10 "time" |
(...skipping 15 matching lines...) Expand all Loading... |
26 c.Assert(err, IsNil) | 26 c.Assert(err, IsNil) |
27 c.Assert(inst1, NotNil) | 27 c.Assert(inst1, NotNil) |
28 id1 := inst1.Id() | 28 id1 := inst1.Id() |
29 | 29 |
30 insts, err = e.Instances([]string{id0, id1}) | 30 insts, err = e.Instances([]string{id0, id1}) |
31 c.Assert(err, IsNil) | 31 c.Assert(err, IsNil) |
32 c.Assert(insts, HasLen, 2) | 32 c.Assert(insts, HasLen, 2) |
33 c.Assert(insts[0].Id(), Equals, id0) | 33 c.Assert(insts[0].Id(), Equals, id0) |
34 c.Assert(insts[1].Id(), Equals, id1) | 34 c.Assert(insts[1].Id(), Equals, id1) |
35 | 35 |
| 36 // order of results is not specified |
| 37 insts, err = e.AllInstances() |
| 38 c.Assert(err, IsNil) |
| 39 c.Assert(insts, HasLen, 2) |
| 40 c.Assert(insts[0].Id(), Not(Equals), insts[1].Id()) |
| 41 |
36 err = e.StopInstances([]environs.Instance{inst0}) | 42 err = e.StopInstances([]environs.Instance{inst0}) |
37 c.Assert(err, IsNil) | 43 c.Assert(err, IsNil) |
38 | 44 |
39 insts, err = e.Instances([]string{id0, id1}) | 45 insts, err = e.Instances([]string{id0, id1}) |
40 c.Assert(err, Equals, environs.ErrPartialInstances) | 46 c.Assert(err, Equals, environs.ErrPartialInstances) |
41 c.Assert(insts[0], IsNil) | 47 c.Assert(insts[0], IsNil) |
42 c.Assert(insts[1].Id(), Equals, id1) | 48 c.Assert(insts[1].Id(), Equals, id1) |
| 49 |
| 50 insts, err = e.AllInstances() |
| 51 c.Assert(err, IsNil) |
| 52 c.Assert(insts[0].Id(), Equals, id1) |
43 } | 53 } |
44 | 54 |
45 func (t *Tests) TestBootstrap(c *C) { | 55 func (t *Tests) TestBootstrap(c *C) { |
46 // TODO tests for Bootstrap(true) | 56 // TODO tests for Bootstrap(true) |
47 e := t.Open(c) | 57 e := t.Open(c) |
48 err := e.Bootstrap(false) | 58 err := e.Bootstrap(false) |
49 c.Assert(err, IsNil) | 59 c.Assert(err, IsNil) |
50 | 60 |
51 info, err := e.StateInfo() | 61 info, err := e.StateInfo() |
52 c.Assert(info, NotNil) | 62 c.Assert(info, NotNil) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 c.Logf("get retrying after earlier get succeeded. *sigh*.") | 183 c.Logf("get retrying after earlier get succeeded. *sigh*.") |
174 time.Sleep(1e9) | 184 time.Sleep(1e9) |
175 } | 185 } |
176 c.Assert(err, IsNil) | 186 c.Assert(err, IsNil) |
177 data, err = ioutil.ReadAll(resp.Body) | 187 data, err = ioutil.ReadAll(resp.Body) |
178 c.Assert(err, IsNil) | 188 c.Assert(err, IsNil) |
179 defer resp.Body.Close() | 189 defer resp.Body.Close() |
180 c.Assert(resp.StatusCode, Equals, 200, Commentf("error response: %s", da
ta)) | 190 c.Assert(resp.StatusCode, Equals, 200, Commentf("error response: %s", da
ta)) |
181 c.Check(data, DeepEquals, contents) | 191 c.Check(data, DeepEquals, contents) |
182 } | 192 } |
OLD | NEW |