Merge lp:~thumper/juju-core/test-import-fix into lp:~go-bot/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 1484
Proposed branch: lp:~thumper/juju-core/test-import-fix
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 216 lines (+41/-39)
2 files modified
container/lxc/lxc_test.go (+33/-32)
container/lxc/test.go (+8/-7)
To merge this branch: bzr merge lp:~thumper/juju-core/test-import-fix
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+175430@code.launchpad.net

Commit message

Update the container tests to use gc prefix.

Only import name changes, nothing else.

https://codereview.appspot.com/11450046/

Description of the change

Update the container tests to use gc prefix.

Only import name changes, nothing else.

https://codereview.appspot.com/11450046/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :
Download full text (7.8 KiB)

Reviewers: mp+175430_code.launchpad.net,

Message:
Please take a look.

Description:
Update the container tests to use gc prefix.

Only import name changes, nothing else.

https://code.launchpad.net/~thumper/juju-core/test-import-fix/+merge/175430

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M container/lxc/lxc_test.go
   M container/lxc/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-20130717131918-jsmkfqhgevnvnlcw
+New revision: <email address hidden>

Index: container/lxc/lxc_test.go
=== modified file 'container/lxc/lxc_test.go'
--- container/lxc/lxc_test.go 2013-07-15 01:16:52 +0000
+++ container/lxc/lxc_test.go 2013-07-17 22:41:36 +0000
@@ -10,19 +10,20 @@
   "path/filepath"
   stdtesting "testing"

- . "launchpad.net/gocheck"
+ gc "launchpad.net/gocheck"
   "launchpad.net/goyaml"
+
   "launchpad.net/juju-core/container/lxc"
   "launchpad.net/juju-core/instance"
   jujutesting "launchpad.net/juju-core/juju/testing"
   "launchpad.net/juju-core/state"
   "launchpad.net/juju-core/testing"
- . "launchpad.net/juju-core/testing/checkers"
+ jc "launchpad.net/juju-core/testing/checkers"
   "launchpad.net/juju-core/version"
  )

  func Test(t *stdtesting.T) {
- TestingT(t)
+ gc.TestingT(t)
  }

  type LxcSuite struct {
@@ -30,29 +31,29 @@
   lxc.TestSuite
  }

-var _ = Suite(&LxcSuite{})
+var _ = gc.Suite(&LxcSuite{})

-func (s *LxcSuite) SetUpSuite(c *C) {
+func (s *LxcSuite) SetUpSuite(c *gc.C) {
   s.LoggingSuite.SetUpSuite(c)
   s.TestSuite.SetUpSuite(c)
  }

-func (s *LxcSuite) TearDownSuite(c *C) {
+func (s *LxcSuite) TearDownSuite(c *gc.C) {
   s.TestSuite.TearDownSuite(c)
   s.LoggingSuite.TearDownSuite(c)
  }

-func (s *LxcSuite) SetUpTest(c *C) {
+func (s *LxcSuite) SetUpTest(c *gc.C) {
   s.LoggingSuite.SetUpTest(c)
   s.TestSuite.SetUpTest(c)
  }

-func (s *LxcSuite) TearDownTest(c *C) {
+func (s *LxcSuite) TearDownTest(c *gc.C) {
   s.TestSuite.TearDownTest(c)
   s.LoggingSuite.TearDownTest(c)
  }

-func StartContainer(c *C, manager lxc.ContainerManager, machineId string)
instance.Instance {
+func StartContainer(c *gc.C, manager lxc.ContainerManager, machineId
string) instance.Instance {
   config := testing.EnvironConfig(c)
   stateInfo := jujutesting.FakeStateInfo(machineId)
   apiInfo := jujutesting.FakeAPIInfo(machineId)
@@ -65,77 +66,77 @@
   }

   inst, err := manager.StartContainer(machineId, series, nonce, tools,
config, stateInfo, apiInfo)
- c.Assert(err, IsNil)
+ c.Assert(err, gc.IsNil)
   return inst
  }

-func (s *LxcSuite) TestStartContainer(c *C) {
+func (s *LxcSuite) TestStartContainer(c *gc.C) {
   manager := lxc.NewContainerManager(lxc.ManagerConfig{})
   instance := StartContainer(c, manager, "1/lxc/0")

   name := string(instance.Id())
   // Check our container config files.
- c.Assert(filepath.Join(s.ContainerDir, name, "lxc.conf"), IsNonEmptyFile)
+ c.Assert(filepath.Join(s.ContainerDir, name, "lxc.conf"),...

Read more...

Revision history for this message
Ian Booth (wallyworld) wrote :
Revision history for this message
Dave Cheney (dave-cheney) wrote :

LGTM. Trivial

On Thu, Jul 18, 2013 at 12:04 PM, Ian Booth <email address hidden> wrote:
> LGTM
>
> https://codereview.appspot.com/11450046/
>
> --
> https://code.launchpad.net/~thumper/juju-core/test-import-fix/+merge/175430
> You are subscribed to branch lp:juju-core.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'container/lxc/lxc_test.go'
2--- container/lxc/lxc_test.go 2013-07-15 01:16:52 +0000
3+++ container/lxc/lxc_test.go 2013-07-17 23:57:27 +0000
4@@ -10,19 +10,20 @@
5 "path/filepath"
6 stdtesting "testing"
7
8- . "launchpad.net/gocheck"
9+ gc "launchpad.net/gocheck"
10 "launchpad.net/goyaml"
11+
12 "launchpad.net/juju-core/container/lxc"
13 "launchpad.net/juju-core/instance"
14 jujutesting "launchpad.net/juju-core/juju/testing"
15 "launchpad.net/juju-core/state"
16 "launchpad.net/juju-core/testing"
17- . "launchpad.net/juju-core/testing/checkers"
18+ jc "launchpad.net/juju-core/testing/checkers"
19 "launchpad.net/juju-core/version"
20 )
21
22 func Test(t *stdtesting.T) {
23- TestingT(t)
24+ gc.TestingT(t)
25 }
26
27 type LxcSuite struct {
28@@ -30,29 +31,29 @@
29 lxc.TestSuite
30 }
31
32-var _ = Suite(&LxcSuite{})
33+var _ = gc.Suite(&LxcSuite{})
34
35-func (s *LxcSuite) SetUpSuite(c *C) {
36+func (s *LxcSuite) SetUpSuite(c *gc.C) {
37 s.LoggingSuite.SetUpSuite(c)
38 s.TestSuite.SetUpSuite(c)
39 }
40
41-func (s *LxcSuite) TearDownSuite(c *C) {
42+func (s *LxcSuite) TearDownSuite(c *gc.C) {
43 s.TestSuite.TearDownSuite(c)
44 s.LoggingSuite.TearDownSuite(c)
45 }
46
47-func (s *LxcSuite) SetUpTest(c *C) {
48+func (s *LxcSuite) SetUpTest(c *gc.C) {
49 s.LoggingSuite.SetUpTest(c)
50 s.TestSuite.SetUpTest(c)
51 }
52
53-func (s *LxcSuite) TearDownTest(c *C) {
54+func (s *LxcSuite) TearDownTest(c *gc.C) {
55 s.TestSuite.TearDownTest(c)
56 s.LoggingSuite.TearDownTest(c)
57 }
58
59-func StartContainer(c *C, manager lxc.ContainerManager, machineId string) instance.Instance {
60+func StartContainer(c *gc.C, manager lxc.ContainerManager, machineId string) instance.Instance {
61 config := testing.EnvironConfig(c)
62 stateInfo := jujutesting.FakeStateInfo(machineId)
63 apiInfo := jujutesting.FakeAPIInfo(machineId)
64@@ -65,77 +66,77 @@
65 }
66
67 inst, err := manager.StartContainer(machineId, series, nonce, tools, config, stateInfo, apiInfo)
68- c.Assert(err, IsNil)
69+ c.Assert(err, gc.IsNil)
70 return inst
71 }
72
73-func (s *LxcSuite) TestStartContainer(c *C) {
74+func (s *LxcSuite) TestStartContainer(c *gc.C) {
75 manager := lxc.NewContainerManager(lxc.ManagerConfig{})
76 instance := StartContainer(c, manager, "1/lxc/0")
77
78 name := string(instance.Id())
79 // Check our container config files.
80- c.Assert(filepath.Join(s.ContainerDir, name, "lxc.conf"), IsNonEmptyFile)
81+ c.Assert(filepath.Join(s.ContainerDir, name, "lxc.conf"), jc.IsNonEmptyFile)
82 cloudInitFilename := filepath.Join(s.ContainerDir, name, "cloud-init")
83- c.Assert(cloudInitFilename, IsNonEmptyFile)
84+ c.Assert(cloudInitFilename, jc.IsNonEmptyFile)
85 data, err := ioutil.ReadFile(cloudInitFilename)
86- c.Assert(err, IsNil)
87- c.Assert(string(data), HasPrefix, "#cloud-config\n")
88+ c.Assert(err, gc.IsNil)
89+ c.Assert(string(data), jc.HasPrefix, "#cloud-config\n")
90
91 x := make(map[interface{}]interface{})
92 err = goyaml.Unmarshal(data, &x)
93- c.Assert(err, IsNil)
94+ c.Assert(err, gc.IsNil)
95
96 var scripts []string
97 for _, s := range x["runcmd"].([]interface{}) {
98 scripts = append(scripts, s.(string))
99 }
100
101- c.Assert(scripts[len(scripts)-1], Equals, "start jujud-machine-1-lxc-0")
102+ c.Assert(scripts[len(scripts)-1], gc.Equals, "start jujud-machine-1-lxc-0")
103
104 // Check the mount point has been created inside the container.
105- c.Assert(filepath.Join(s.LxcDir, name, "rootfs/var/log/juju"), IsDirectory)
106+ c.Assert(filepath.Join(s.LxcDir, name, "rootfs/var/log/juju"), jc.IsDirectory)
107 }
108
109-func (s *LxcSuite) TestStopContainer(c *C) {
110+func (s *LxcSuite) TestStopContainer(c *gc.C) {
111 manager := lxc.NewContainerManager(lxc.ManagerConfig{})
112 instance := StartContainer(c, manager, "1/lxc/0")
113
114 err := manager.StopContainer(instance)
115- c.Assert(err, IsNil)
116+ c.Assert(err, gc.IsNil)
117
118 name := string(instance.Id())
119 // Check that the container dir is no longer in the container dir
120- c.Assert(filepath.Join(s.ContainerDir, name), DoesNotExist)
121+ c.Assert(filepath.Join(s.ContainerDir, name), jc.DoesNotExist)
122 // but instead, in the removed container dir
123- c.Assert(filepath.Join(s.RemovedDir, name), IsDirectory)
124+ c.Assert(filepath.Join(s.RemovedDir, name), jc.IsDirectory)
125 }
126
127-func (s *LxcSuite) TestStopContainerNameClash(c *C) {
128+func (s *LxcSuite) TestStopContainerNameClash(c *gc.C) {
129 manager := lxc.NewContainerManager(lxc.ManagerConfig{})
130 instance := StartContainer(c, manager, "1/lxc/0")
131
132 name := string(instance.Id())
133 targetDir := filepath.Join(s.RemovedDir, name)
134 err := os.MkdirAll(targetDir, 0755)
135- c.Assert(err, IsNil)
136+ c.Assert(err, gc.IsNil)
137
138 err = manager.StopContainer(instance)
139- c.Assert(err, IsNil)
140+ c.Assert(err, gc.IsNil)
141
142 // Check that the container dir is no longer in the container dir
143- c.Assert(filepath.Join(s.ContainerDir, name), DoesNotExist)
144+ c.Assert(filepath.Join(s.ContainerDir, name), jc.DoesNotExist)
145 // but instead, in the removed container dir with a ".1" suffix as there was already a directory there.
146- c.Assert(filepath.Join(s.RemovedDir, fmt.Sprintf("%s.1", name)), IsDirectory)
147+ c.Assert(filepath.Join(s.RemovedDir, fmt.Sprintf("%s.1", name)), jc.IsDirectory)
148 }
149
150-func (s *LxcSuite) TestNamedManagerPrefix(c *C) {
151+func (s *LxcSuite) TestNamedManagerPrefix(c *gc.C) {
152 manager := lxc.NewContainerManager(lxc.ManagerConfig{Name: "eric"})
153 instance := StartContainer(c, manager, "1/lxc/0")
154- c.Assert(string(instance.Id()), Equals, "eric-machine-1-lxc-0")
155+ c.Assert(string(instance.Id()), gc.Equals, "eric-machine-1-lxc-0")
156 }
157
158-func (s *LxcSuite) TestListContainers(c *C) {
159+func (s *LxcSuite) TestListContainers(c *gc.C) {
160 foo := lxc.NewContainerManager(lxc.ManagerConfig{Name: "foo"})
161 bar := lxc.NewContainerManager(lxc.ManagerConfig{Name: "bar"})
162
163@@ -147,10 +148,10 @@
164 bar2 := StartContainer(c, bar, "1/lxc/1")
165
166 result, err := foo.ListContainers()
167- c.Assert(err, IsNil)
168+ c.Assert(err, gc.IsNil)
169 testing.MatchInstances(c, result, foo1, foo2, foo3)
170
171 result, err = bar.ListContainers()
172- c.Assert(err, IsNil)
173+ c.Assert(err, gc.IsNil)
174 testing.MatchInstances(c, result, bar1, bar2)
175 }
176
177=== modified file 'container/lxc/test.go'
178--- container/lxc/test.go 2013-06-27 04:48:10 +0000
179+++ container/lxc/test.go 2013-07-17 23:57:27 +0000
180@@ -8,8 +8,9 @@
181 package lxc
182
183 import (
184- . "launchpad.net/gocheck"
185+ gc "launchpad.net/gocheck"
186 "launchpad.net/golxc"
187+
188 "launchpad.net/juju-core/container/lxc/mock"
189 )
190
191@@ -54,11 +55,11 @@
192 oldLxcContainerDir string
193 }
194
195-func (s *TestSuite) SetUpSuite(c *C) {}
196-
197-func (s *TestSuite) TearDownSuite(c *C) {}
198-
199-func (s *TestSuite) SetUpTest(c *C) {
200+func (s *TestSuite) SetUpSuite(c *gc.C) {}
201+
202+func (s *TestSuite) TearDownSuite(c *gc.C) {}
203+
204+func (s *TestSuite) SetUpTest(c *gc.C) {
205 s.ContainerDir = c.MkDir()
206 s.oldContainerDir = SetContainerDir(s.ContainerDir)
207 s.RemovedDir = c.MkDir()
208@@ -69,7 +70,7 @@
209 s.oldFactory = SetLxcFactory(s.Factory)
210 }
211
212-func (s *TestSuite) TearDownTest(c *C) {
213+func (s *TestSuite) TearDownTest(c *gc.C) {
214 SetContainerDir(s.oldContainerDir)
215 SetLxcContainerDir(s.oldLxcContainerDir)
216 SetRemovedContainerDir(s.oldRemovedDir)

Subscribers

People subscribed via source and target branches

to status/vote changes: