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

Delta Between Two Patch Sets: environs/ec2/live_test.go

Issue 6145043: cmd/juju: add --upload-tools flag to bootstrap command
Left Patch Set: cmd/juju: add --upload-tools flag to bootstrap command Created 12 years, 10 months ago
Right Patch Set: cmd/juju: add --upload-tools flag to bootstrap command Created 12 years, 10 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:
Right: Side by side diff | Download
« no previous file with change/comment | « environs/ec2/export_test.go ('k') | environs/ec2/local_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 amzec2 "launchpad.net/goamz/ec2" 7 amzec2 "launchpad.net/goamz/ec2"
8 "launchpad.net/goamz/s3"
9 . "launchpad.net/gocheck" 8 . "launchpad.net/gocheck"
10 "launchpad.net/juju/go/environs" 9 "launchpad.net/juju/go/environs"
11 "launchpad.net/juju/go/environs/ec2" 10 "launchpad.net/juju/go/environs/ec2"
12 "launchpad.net/juju/go/environs/jujutest" 11 "launchpad.net/juju/go/environs/jujutest"
13 "launchpad.net/juju/go/testing" 12 "launchpad.net/juju/go/testing"
14 "strings" 13 "strings"
15 "time" 14 "time"
16 ) 15 )
17 16
18 // amazonConfig holds the environments configuration 17 // amazonConfig holds the environments configuration
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 case inst1.Id(): 190 case inst1.Id():
192 c.Assert(hasSecurityGroup(r, groups[2]), Equals, true, m sg) 191 c.Assert(hasSecurityGroup(r, groups[2]), Equals, true, m sg)
193 c.Assert(hasSecurityGroup(r, groups[1]), Equals, false, msg) 192 c.Assert(hasSecurityGroup(r, groups[1]), Equals, false, msg)
194 default: 193 default:
195 c.Errorf("unknown instance found: %v", inst) 194 c.Errorf("unknown instance found: %v", inst)
196 } 195 }
197 } 196 }
198 } 197 }
199 198
200 func (t *LiveTests) TestDestroy(c *C) { 199 func (t *LiveTests) TestDestroy(c *C) {
201 » err := t.Env.PutFile("foo", strings.NewReader("foo"), 3) 200 » s := t.Env.Storage()
202 » c.Assert(err, IsNil) 201 » err := s.Put("foo", strings.NewReader("foo"), 3)
203 » err = t.Env.PutFile("bar", strings.NewReader("bar"), 3) 202 » c.Assert(err, IsNil)
203 » err = s.Put("bar", strings.NewReader("bar"), 3)
204 c.Assert(err, IsNil) 204 c.Assert(err, IsNil)
205 205
206 // Check that bucket exists, so we can be sure 206 // Check that bucket exists, so we can be sure
207 // we have checked correctly that it's been destroyed. 207 // we have checked correctly that it's been destroyed.
208 » b := ec2.EnvironBucket(t.Env) 208 » names, err := s.List("")
209 » resp, err := b.List("", "", "", 0) 209 » c.Assert(err, IsNil)
210 » c.Assert(err, IsNil) 210 » c.Assert(len(names) >= 2, Equals, true)
211 » c.Assert(len(resp.Contents) >= 2, Equals, true)
212 211
213 t.Destroy(c) 212 t.Destroy(c)
214 213
215 » resp, err = b.List("", "", "", 0) 214 » names, err = s.List("")
216 » c.Assert(err, NotNil) 215 » var notFoundError *environs.NotFoundError
217 » c.Assert(err.(*s3.Error).StatusCode, Equals, 404) 216 » c.Assert(err, FitsTypeOf, notFoundError)
218 } 217 }
219 218
220 func checkPortAllowed(c *C, perms []amzec2.IPPerm, port int) { 219 func checkPortAllowed(c *C, perms []amzec2.IPPerm, port int) {
221 for _, perm := range perms { 220 for _, perm := range perms {
222 if perm.FromPort == port { 221 if perm.FromPort == port {
223 c.Check(perm.Protocol, Equals, "tcp") 222 c.Check(perm.Protocol, Equals, "tcp")
224 c.Check(perm.ToPort, Equals, port) 223 c.Check(perm.ToPort, Equals, port)
225 c.Check(perm.SourceIPs, DeepEquals, []string{"0.0.0.0/0" }) 224 c.Check(perm.SourceIPs, DeepEquals, []string{"0.0.0.0/0" })
226 c.Check(perm.SourceGroups, HasLen, 0) 225 c.Check(perm.SourceGroups, HasLen, 0)
227 return 226 return
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 290 }
292 291
293 func hasSecurityGroup(r amzec2.Reservation, g amzec2.SecurityGroup) bool { 292 func hasSecurityGroup(r amzec2.Reservation, g amzec2.SecurityGroup) bool {
294 for _, rg := range r.SecurityGroups { 293 for _, rg := range r.SecurityGroups {
295 if rg.Id == g.Id { 294 if rg.Id == g.Id {
296 return true 295 return true
297 } 296 }
298 } 297 }
299 return false 298 return false
300 } 299 }
LEFTRIGHT

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