OLD | NEW |
1 package ec2_test | 1 package ec2_test |
2 | 2 |
3 import ( | 3 import ( |
4 "crypto/rand" | 4 "crypto/rand" |
5 "fmt" | 5 "fmt" |
6 "io" | 6 "io" |
7 "io/ioutil" | 7 "io/ioutil" |
8 amzec2 "launchpad.net/goamz/ec2" | 8 amzec2 "launchpad.net/goamz/ec2" |
9 . "launchpad.net/gocheck" | 9 . "launchpad.net/gocheck" |
10 "launchpad.net/juju-core/environs" | 10 "launchpad.net/juju-core/environs" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 func (t *LiveTests) SetUpTest(c *C) { | 92 func (t *LiveTests) SetUpTest(c *C) { |
93 t.LoggingSuite.SetUpTest(c) | 93 t.LoggingSuite.SetUpTest(c) |
94 t.LiveTests.SetUpTest(c) | 94 t.LiveTests.SetUpTest(c) |
95 } | 95 } |
96 | 96 |
97 func (t *LiveTests) TearDownTest(c *C) { | 97 func (t *LiveTests) TearDownTest(c *C) { |
98 t.LiveTests.TearDownTest(c) | 98 t.LiveTests.TearDownTest(c) |
99 t.LoggingSuite.TearDownTest(c) | 99 t.LoggingSuite.TearDownTest(c) |
100 } | 100 } |
101 | 101 |
| 102 // TODO(niemeyer): Looks like many of those tests should be moved to jujutest.Li
veTests. |
| 103 |
102 func (t *LiveTests) TestInstanceDNSName(c *C) { | 104 func (t *LiveTests) TestInstanceDNSName(c *C) { |
103 inst, err := t.Env.StartInstance(30, jujutest.InvalidStateInfo, nil) | 105 inst, err := t.Env.StartInstance(30, jujutest.InvalidStateInfo, nil) |
104 c.Assert(err, IsNil) | 106 c.Assert(err, IsNil) |
105 defer t.Env.StopInstances([]environs.Instance{inst}) | 107 defer t.Env.StopInstances([]environs.Instance{inst}) |
106 dns, err := inst.WaitDNSName() | 108 dns, err := inst.WaitDNSName() |
107 » c.Check(err, IsNil) | 109 » // TODO(niemeyer): This assert sometimes fails with "no instances found" |
108 » c.Check(dns, Not(Equals), "") | 110 » c.Assert(err, IsNil) |
| 111 » c.Assert(dns, Not(Equals), "") |
109 | 112 |
110 insts, err := t.Env.Instances([]string{inst.Id()}) | 113 insts, err := t.Env.Instances([]string{inst.Id()}) |
111 c.Assert(err, IsNil) | 114 c.Assert(err, IsNil) |
112 c.Assert(len(insts), Equals, 1) | 115 c.Assert(len(insts), Equals, 1) |
113 | 116 |
114 ec2inst := ec2.InstanceEC2(insts[0]) | 117 ec2inst := ec2.InstanceEC2(insts[0]) |
115 » c.Check(ec2inst.DNSName, Equals, dns) | 118 » c.Assert(ec2inst.DNSName, Equals, dns) |
116 } | 119 } |
117 | 120 |
118 func (t *LiveTests) TestInstanceGroups(c *C) { | 121 func (t *LiveTests) TestInstanceGroups(c *C) { |
119 ec2conn := ec2.EnvironEC2(t.Env) | 122 ec2conn := ec2.EnvironEC2(t.Env) |
120 | 123 |
121 groups := amzec2.SecurityGroupNames( | 124 groups := amzec2.SecurityGroupNames( |
122 ec2.GroupName(t.Env), | 125 ec2.GroupName(t.Env), |
123 ec2.MachineGroupName(t.Env, 98), | 126 ec2.MachineGroupName(t.Env, 98), |
124 ec2.MachineGroupName(t.Env, 99), | 127 ec2.MachineGroupName(t.Env, 99), |
125 ) | 128 ) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 396 } |
394 | 397 |
395 func hasSecurityGroup(r amzec2.Reservation, g amzec2.SecurityGroup) bool { | 398 func hasSecurityGroup(r amzec2.Reservation, g amzec2.SecurityGroup) bool { |
396 for _, rg := range r.SecurityGroups { | 399 for _, rg := range r.SecurityGroups { |
397 if rg.Id == g.Id { | 400 if rg.Id == g.Id { |
398 return true | 401 return true |
399 } | 402 } |
400 } | 403 } |
401 return false | 404 return false |
402 } | 405 } |
OLD | NEW |