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

Side by Side Diff: environs/jujutest/livetests.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 5 years, 7 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
« no previous file with comments | « environs/interface.go ('k') | environs/jujutest/tests.go » ('j') | 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 "fmt" 4 "fmt"
5 . "launchpad.net/gocheck" 5 . "launchpad.net/gocheck"
6 "launchpad.net/juju-core/juju/environs" 6 "launchpad.net/juju-core/juju/environs"
7 "launchpad.net/juju-core/juju/state" 7 "launchpad.net/juju-core/juju/state"
8 "time" 8 "time"
9 ) 9 )
10 10
11 // TestStartStop is similar to Tests.TestStartStop except 11 // TestStartStop is similar to Tests.TestStartStop except
12 // that it does not assume a pristine environment. 12 // that it does not assume a pristine environment.
13 func (t *LiveTests) TestStartStop(c *C) { 13 func (t *LiveTests) TestStartStop(c *C) {
14 insts, err := t.Env.Instances(nil) 14 insts, err := t.Env.Instances(nil)
15 c.Assert(err, IsNil) 15 c.Assert(err, IsNil)
16 c.Check(insts, HasLen, 0) 16 c.Check(insts, HasLen, 0)
17 17
18 inst, err := t.Env.StartInstance(0, InvalidStateInfo) 18 inst, err := t.Env.StartInstance(0, InvalidStateInfo)
19 c.Assert(err, IsNil) 19 c.Assert(err, IsNil)
20 c.Assert(inst, NotNil) 20 c.Assert(inst, NotNil)
21 id0 := inst.Id() 21 id0 := inst.Id()
22 22
23 insts, err = t.Env.Instances([]string{id0, id0}) 23 insts, err = t.Env.Instances([]string{id0, id0})
24 c.Assert(err, IsNil) 24 c.Assert(err, IsNil)
25 c.Assert(insts, HasLen, 2) 25 c.Assert(insts, HasLen, 2)
26 c.Assert(insts[0].Id(), Equals, id0) 26 c.Assert(insts[0].Id(), Equals, id0)
27 c.Assert(insts[1].Id(), Equals, id0) 27 c.Assert(insts[1].Id(), Equals, id0)
28 28
29 insts, err = t.Env.AllInstances()
30 c.Assert(err, IsNil)
31 c.Assert(insts, HasLen, 1)
32 c.Assert(insts[0].Id(), Equals, id0)
33
29 dns, err := inst.WaitDNSName() 34 dns, err := inst.WaitDNSName()
30 c.Assert(err, IsNil) 35 c.Assert(err, IsNil)
31 c.Assert(dns, Not(Equals), "") 36 c.Assert(dns, Not(Equals), "")
32 37
33 insts, err = t.Env.Instances([]string{id0, ""}) 38 insts, err = t.Env.Instances([]string{id0, ""})
34 c.Assert(err, Equals, environs.ErrPartialInstances) 39 c.Assert(err, Equals, environs.ErrPartialInstances)
35 c.Assert(insts, HasLen, 2) 40 c.Assert(insts, HasLen, 2)
36 c.Check(insts[0].Id(), Equals, id0) 41 c.Check(insts[0].Id(), Equals, id0)
37 c.Check(insts[1], IsNil) 42 c.Check(insts[1], IsNil)
38 43
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 c.Errorf("file name %q not found in file list %q", name, names) 112 c.Errorf("file name %q not found in file list %q", name, names)
108 } 113 }
109 114
110 err = storage.Remove(name) 115 err = storage.Remove(name)
111 c.Check(err, IsNil) 116 c.Check(err, IsNil)
112 checkFileDoesNotExist(c, storage, name) 117 checkFileDoesNotExist(c, storage, name)
113 // removing a file that does not exist should not be an error. 118 // removing a file that does not exist should not be an error.
114 err = storage.Remove(name) 119 err = storage.Remove(name)
115 c.Check(err, IsNil) 120 c.Check(err, IsNil)
116 } 121 }
OLDNEW
« no previous file with comments | « environs/interface.go ('k') | environs/jujutest/tests.go » ('j') | no next file with comments »

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