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