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

Side by Side Diff: environs/jujutest/tests.go

Issue 6307071: environs: add the facility to query all running instances (Closed)
Patch Set: environs: add the facility to query all running instances Created 13 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« environs/ec2/ec2.go ('K') | « environs/jujutest/livetests.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« environs/ec2/ec2.go ('K') | « environs/jujutest/livetests.go ('k') | no next file » | no next file with comments »

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