Left: | ||
Right: |
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 } | 181 } |
182 | 182 |
183 // The old juju group should have been reused. | 183 // The old juju group should have been reused. |
184 c.Check(groups[0].Id, Equals, oldJujuGroup.Id) | 184 c.Check(groups[0].Id, Equals, oldJujuGroup.Id) |
185 | 185 |
186 // Check that it authorizes the correct ports and there | 186 // Check that it authorizes the correct ports and there |
187 // are no extra permissions (in particular we are checking | 187 // are no extra permissions (in particular we are checking |
188 // that the unneeded permission that we added earlier | 188 // that the unneeded permission that we added earlier |
189 // has been deleted). | 189 // has been deleted). |
190 perms := info[0].IPPerms | 190 perms := info[0].IPPerms |
191 » c.Assert(perms, HasLen, 4) | 191 » c.Assert(perms, HasLen, 5) |
192 checkPortAllowed(c, perms, 22) | 192 checkPortAllowed(c, perms, 22) |
193 checkPortAllowed(c, perms, ec2.MgoPort) | |
niemeyer
2012/11/28 15:58:37
37017 should be tested explicitly, otherwise we're
rog
2012/11/28 18:08:05
Done.
niemeyer
2012/11/28 18:37:51
Apparently not.
| |
193 checkSecurityGroupAllowed(c, perms, groups[0]) | 194 checkSecurityGroupAllowed(c, perms, groups[0]) |
194 | 195 |
195 // The old machine group should have been reused also. | 196 // The old machine group should have been reused also. |
196 c.Check(groups[2].Id, Equals, oldMachineGroup.Id) | 197 c.Check(groups[2].Id, Equals, oldMachineGroup.Id) |
197 | 198 |
198 // Check that each instance is part of the correct groups. | 199 // Check that each instance is part of the correct groups. |
199 resp, err := ec2conn.Instances([]string{inst0.Id(), inst1.Id()}, nil) | 200 resp, err := ec2conn.Instances([]string{inst0.Id(), inst1.Id()}, nil) |
200 c.Assert(err, IsNil) | 201 c.Assert(err, IsNil) |
201 c.Assert(resp.Reservations, HasLen, 2) | 202 c.Assert(resp.Reservations, HasLen, 2) |
202 for _, r := range resp.Reservations { | 203 for _, r := range resp.Reservations { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 } | 390 } |
390 | 391 |
391 func hasSecurityGroup(r amzec2.Reservation, g amzec2.SecurityGroup) bool { | 392 func hasSecurityGroup(r amzec2.Reservation, g amzec2.SecurityGroup) bool { |
392 for _, rg := range r.SecurityGroups { | 393 for _, rg := range r.SecurityGroups { |
393 if rg.Id == g.Id { | 394 if rg.Id == g.Id { |
394 return true | 395 return true |
395 } | 396 } |
396 } | 397 } |
397 return false | 398 return false |
398 } | 399 } |
OLD | NEW |