Merge lp:~gz/goose/tool_test_weirdness into lp:goose

Proposed by Martin Packman on 2014-05-01
Status: Merged
Approved by: Martin Packman on 2014-05-01
Approved revision: 120
Merged at revision: 120
Proposed branch: lp:~gz/goose/tool_test_weirdness
Merge into: lp:goose
Diff against target: 60 lines (+6/-7)
1 file modified
tools/secgroup-delete-all/main_test.go (+6/-7)
To merge this branch: bzr merge lp:~gz/goose/tool_test_weirdness
Reviewer Review Type Date Requested Status
Juju Engineering 2014-05-01 Pending
Review via email: mp+217962@code.launchpad.net

Commit message

tools/secgroup-delete-all: Change test package

Change tests to be in package main rather than main_test,
which may work around an odd issue on the landing bot.

https://codereview.appspot.com/91010044/

R=axwalk, hduran-8

Description of the change

tools/secgroup-delete-all: Change test package

Change tests to be in package main rather than main_test,
which may work around an odd issue on the landing bot.

https://codereview.appspot.com/91010044/

To post a comment you must log in.
Martin Packman (gz) wrote :

Reviewers: mp+217962_code.launchpad.net,

Message:
Please take a look.

Description:
tools/secgroup-delete-all: Change test package

Change tests to be in package main rather than main_test,
which may work around an odd issue on the landing bot.

https://code.launchpad.net/~gz/goose/tool_test_weirdness/+merge/217962

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/91010044/

Affected files (+8, -7 lines):
   A [revision details]
   M tools/secgroup-delete-all/main_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20140423072524-vxav71c7ko4lgtcu
+New revision: <email address hidden>

Index: tools/secgroup-delete-all/main_test.go
=== modified file 'tools/secgroup-delete-all/main_test.go'
--- tools/secgroup-delete-all/main_test.go 2013-06-22 11:39:35 +0000
+++ tools/secgroup-delete-all/main_test.go 2014-05-01 18:04:32 +0000
@@ -1,4 +1,4 @@
-package main_test
+package main

  import (
   "bytes"
@@ -10,7 +10,6 @@
   "launchpad.net/goose/testing/httpsuite"
   "launchpad.net/goose/testservices/hook"
   "launchpad.net/goose/testservices/openstackservice"
- tool "launchpad.net/goose/tools/secgroup-delete-all"
   "testing"
  )

@@ -33,7 +32,7 @@
  var _ = Suite(&ToolSuite{})

  // GZ 2013-01-21: Should require EnvSuite for this, but clashes with
HTTPSuite
-func createNovaClient(creds *identity.Credentials) *nova.Client {
+func createNovaClientFromCreds(creds *identity.Credentials) *nova.Client {
   osc := client.NewClient(creds, identity.AuthUserPass, nil)
   return nova.New(osc)
  }
@@ -48,13 +47,13 @@
   }
   openstack := openstackservice.New(creds, identity.AuthUserPass)
   openstack.SetupHTTP(s.Mux)
- return openstack, createNovaClient(creds)
+ return openstack, createNovaClientFromCreds(creds)
  }

  func (s *ToolSuite) TestNoGroups(c *C) {
   _, nova := s.makeServices(c)
   var buf bytes.Buffer
- err := tool.DeleteAll(&buf, nova)
+ err := DeleteAll(&buf, nova)
   c.Assert(err, IsNil)
   c.Assert(string(buf.Bytes()), Equals, "No security groups to delete.\n")
  }
@@ -64,7 +63,7 @@
   novaClient.CreateSecurityGroup("group-a", "A group")
   novaClient.CreateSecurityGroup("group-b", "Another group")
   var buf bytes.Buffer
- err := tool.DeleteAll(&buf, novaClient)
+ err := DeleteAll(&buf, novaClient)
   c.Assert(err, IsNil)
   c.Assert(string(buf.Bytes()), Equals, "2 security groups deleted.\n")
  }
@@ -89,7 +88,7 @@
   cleanup := os.Nova.RegisterControlPoint("removeSecurityGroup",
deleteGroupError)
   defer cleanup()
   var buf bytes.Buffer
- err := tool.DeleteAll(&buf, novaClient)
+ err := DeleteAll(&buf, novaClient)
   c.Assert(err, IsNil)
   c.Assert(string(buf.Bytes()), Equals, "2 security groups deleted.\n1
security groups could not be deleted.\n")
  }

Horacio DurĂ¡n (hduran-8) wrote :

On 2014/05/01 18:08:16, gz wrote:
> Please take a look.

LGTM

https://codereview.appspot.com/91010044/

Andrew Wilkins (axwalk) wrote :

On 2014/05/01 18:08:16, gz wrote:
> Please take a look.

LGTM

https://codereview.appspot.com/91010044/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/secgroup-delete-all/main_test.go'
2--- tools/secgroup-delete-all/main_test.go 2013-06-22 11:39:35 +0000
3+++ tools/secgroup-delete-all/main_test.go 2014-05-01 18:07:33 +0000
4@@ -1,4 +1,4 @@
5-package main_test
6+package main
7
8 import (
9 "bytes"
10@@ -10,7 +10,6 @@
11 "launchpad.net/goose/testing/httpsuite"
12 "launchpad.net/goose/testservices/hook"
13 "launchpad.net/goose/testservices/openstackservice"
14- tool "launchpad.net/goose/tools/secgroup-delete-all"
15 "testing"
16 )
17
18@@ -33,7 +32,7 @@
19 var _ = Suite(&ToolSuite{})
20
21 // GZ 2013-01-21: Should require EnvSuite for this, but clashes with HTTPSuite
22-func createNovaClient(creds *identity.Credentials) *nova.Client {
23+func createNovaClientFromCreds(creds *identity.Credentials) *nova.Client {
24 osc := client.NewClient(creds, identity.AuthUserPass, nil)
25 return nova.New(osc)
26 }
27@@ -48,13 +47,13 @@
28 }
29 openstack := openstackservice.New(creds, identity.AuthUserPass)
30 openstack.SetupHTTP(s.Mux)
31- return openstack, createNovaClient(creds)
32+ return openstack, createNovaClientFromCreds(creds)
33 }
34
35 func (s *ToolSuite) TestNoGroups(c *C) {
36 _, nova := s.makeServices(c)
37 var buf bytes.Buffer
38- err := tool.DeleteAll(&buf, nova)
39+ err := DeleteAll(&buf, nova)
40 c.Assert(err, IsNil)
41 c.Assert(string(buf.Bytes()), Equals, "No security groups to delete.\n")
42 }
43@@ -64,7 +63,7 @@
44 novaClient.CreateSecurityGroup("group-a", "A group")
45 novaClient.CreateSecurityGroup("group-b", "Another group")
46 var buf bytes.Buffer
47- err := tool.DeleteAll(&buf, novaClient)
48+ err := DeleteAll(&buf, novaClient)
49 c.Assert(err, IsNil)
50 c.Assert(string(buf.Bytes()), Equals, "2 security groups deleted.\n")
51 }
52@@ -89,7 +88,7 @@
53 cleanup := os.Nova.RegisterControlPoint("removeSecurityGroup", deleteGroupError)
54 defer cleanup()
55 var buf bytes.Buffer
56- err := tool.DeleteAll(&buf, novaClient)
57+ err := DeleteAll(&buf, novaClient)
58 c.Assert(err, IsNil)
59 c.Assert(string(buf.Bytes()), Equals, "2 security groups deleted.\n1 security groups could not be deleted.\n")
60 }

Subscribers

People subscribed via source and target branches