Merge lp:~mattyw/juju-core/gocheck_included_in_build_fix into lp:~go-bot/juju-core/trunk
- gocheck_included_in_build_fix
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2044 |
Proposed branch: | lp:~mattyw/juju-core/gocheck_included_in_build_fix |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
267 lines (+60/-62) 7 files modified
cmd/jujud/machine_test.go (+2/-2) container/lxc/lxc.go (+15/-15) container/lxc/lxc_test.go (+2/-1) container/lxc/test.go (+0/-40) container/lxc/testing/test.go (+37/-0) provider/local/environprovider_test.go (+2/-2) worker/provisioner/lxc-broker_test.go (+2/-2) |
To merge this branch: | bzr merge lp:~mattyw/juju-core/gocheck_included_in_build_fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John A Meinel | Approve | ||
Review via email: mp+192411@code.launchpad.net |
Commit message
Bug fix for lp:1243942
Move test package into testing directory to prevent gocheck being included in build
Description of the change
Bug fix for lp:1243942
Move test package into testing directory to prevent gocheck being included in build
Matthew Williams (mattyw) wrote : | # |
Andrew Wilkins (axwalk) wrote : | # |
On 2013/10/23 22:05:20, matthew.williams wrote:
> Please take a look.
The lp: points to "Open Rails Tracker". I don't think that's right? :)
Just as a general thing, it's useful to include a description of the
fix, as well as a pointer to the bug.
Matthew Williams (mattyw) wrote : | # |
On 2013/10/23 22:42:20, axw wrote:
> On 2013/10/23 22:05:20, matthew.williams wrote:
> > Please take a look.
> The lp: points to "Open Rails Tracker". I don't think that's right? :)
> Just as a general thing, it's useful to include a description of the
fix, as
> well as a pointer to the bug.
My bad, sorry.
Just fixing
Matthew Williams (mattyw) wrote : | # |
Please take a look.
Andrew Wilkins (axwalk) wrote : | # |
On 2013/10/23 22:58:47, mattyw wrote:
> On 2013/10/23 22:42:20, axw wrote:
> > On 2013/10/23 22:05:20, matthew.williams wrote:
> > > Please take a look.
> >
> > The lp: points to "Open Rails Tracker". I don't think that's right?
:)
> >
> > Just as a general thing, it's useful to include a description of the
fix, as
> > well as a pointer to the bug.
> My bad, sorry.
> Just fixing
No worries! Thanks for fixing the issue.
Andrew Wilkins (axwalk) wrote : | # |
https:/
File cmd/jujud/
https:/
cmd/jujud/
Should that be s/test/testing/? IMHO, an alias of lxctesting would be
useful, like envtesting.
https:/
File container/
https:/
container/
There's a convention for vars that are exported just for tests. Instead
of this, we do "var containerDir = ..." in this file, and then in a new
file called "export_test.go" have "var ContainerDir = containerDir".
That makes it a bit more obvious why it's exported. If you do that, all
the other case changes can (should) be reverted.
https:/
File container/
https:/
container/
testing/lxctesting?
https:/
File container/
https:/
container/
should *ONLY* be used for testing. These
I think this comment is kinda redundant now; this can be inferred from
its package.
https:/
File provider/
https:/
provider/
testing/lxctesting?
https:/
File worker/
https:/
worker/
testing/lxctesting?
Matthew Williams (mattyw) wrote : | # |
Please take a look.
Matthew Williams (mattyw) wrote : | # |
Please take a look.
Matthew Williams (mattyw) wrote : | # |
On 2013/10/28 13:26:40, mattyw wrote:
> Please take a look.
I'm not able to use the export_test model because the lxc testing
package is used by tests in other packages
Andrew Wilkins (axwalk) wrote : | # |
On 2013/10/28 13:58:40, mattyw wrote:
> On 2013/10/28 13:26:40, mattyw wrote:
> > Please take a look.
> I'm not able to use the export_test model because the lxc testing
package is
> used by tests in other packages
Ah, of course, sorry. LGTM. Thanks for fixing this.
John A Meinel (jameinel) wrote : | # |
axw, can you confirm that this is fully approved and then land it for Matthew? I don't think he has rights to set the MP to Approved.
John A Meinel (jameinel) wrote : | # |
Just for my 2c, it LGTM, but I'd like the original conversation to finish it.
Matthew Williams (mattyw) wrote : | # |
> Just for my 2c, it LGTM, but I'd like the original conversation to finish it.
Thanks John.
I'm afraid I don't know what you mean by "I'd like the original conversation to finish it."
Andrew Wilkins (axwalk) wrote : | # |
@mattyw: I think he just meant he wants me to ack/nack.
Anyway, still LGTM - I didn't occur to me you didn't have access. Approving.
Go Bot (go-bot) wrote : | # |
Attempt to merge into lp:juju-core failed due to conflicts:
text conflict in container/
John A Meinel (jameinel) wrote : | # |
The conflict means you need to merge trunk again and resolve it, and then
push back to Launchpad. Let us know when you finish and we'll submit it
again.
John
=:->
On Nov 11, 2013 5:29 AM, "Go Bot" <email address hidden> wrote:
> The proposal to merge lp:~mattyw/juju-core/gocheck_included_in_build_fix
> into lp:juju-core has been updated.
>
> Status: Approved => Needs review
>
> For more details, see:
>
> https:/
> --
>
> https:/
> You are reviewing the proposed merge of
> lp:~mattyw/juju-core/gocheck_included_in_build_fix into lp:juju-core.
>
Matthew Williams (mattyw) wrote : | # |
Please take a look.
Matthew Williams (mattyw) wrote : | # |
Please take a look.
Preview Diff
1 | === modified file 'cmd/jujud/machine_test.go' |
2 | --- cmd/jujud/machine_test.go 2013-11-05 08:06:56 +0000 |
3 | +++ cmd/jujud/machine_test.go 2013-11-11 10:57:52 +0000 |
4 | @@ -13,7 +13,7 @@ |
5 | "launchpad.net/juju-core/agent" |
6 | "launchpad.net/juju-core/charm" |
7 | "launchpad.net/juju-core/cmd" |
8 | - "launchpad.net/juju-core/container/lxc" |
9 | + lxctesting "launchpad.net/juju-core/container/lxc/testing" |
10 | envtesting "launchpad.net/juju-core/environs/testing" |
11 | "launchpad.net/juju-core/errors" |
12 | "launchpad.net/juju-core/instance" |
13 | @@ -35,7 +35,7 @@ |
14 | |
15 | type MachineSuite struct { |
16 | agentSuite |
17 | - lxc.TestSuite |
18 | + lxctesting.TestSuite |
19 | } |
20 | |
21 | var _ = gc.Suite(&MachineSuite{}) |
22 | |
23 | === modified file 'container/lxc/lxc.go' |
24 | --- container/lxc/lxc.go 2013-10-31 21:27:57 +0000 |
25 | +++ container/lxc/lxc.go 2013-11-11 10:57:52 +0000 |
26 | @@ -24,12 +24,12 @@ |
27 | |
28 | var ( |
29 | defaultTemplate = "ubuntu-cloud" |
30 | - containerDir = "/var/lib/juju/containers" |
31 | - removedContainerDir = "/var/lib/juju/removed-containers" |
32 | - lxcContainerDir = "/var/lib/lxc" |
33 | - lxcRestartDir = "/etc/lxc/auto" |
34 | - lxcObjectFactory = golxc.Factory() |
35 | aptHTTPProxyRE = regexp.MustCompile(`(?i)^Acquire::HTTP::Proxy\s+"([^"]+)";$`) |
36 | + ContainerDir = "/var/lib/juju/containers" |
37 | + RemovedContainerDir = "/var/lib/juju/removed-containers" |
38 | + LxcContainerDir = "/var/lib/lxc" |
39 | + LxcRestartDir = "/etc/lxc/auto" |
40 | + LxcObjectFactory = golxc.Factory() |
41 | ) |
42 | |
43 | const ( |
44 | @@ -115,7 +115,7 @@ |
45 | // Note here that the lxcObjectFacotry only returns a valid container |
46 | // object, and doesn't actually construct the underlying lxc container on |
47 | // disk. |
48 | - container := lxcObjectFactory.New(name) |
49 | + container := LxcObjectFactory.New(name) |
50 | |
51 | // Create the cloud-init. |
52 | directory := jujuContainerDirectory(name) |
53 | @@ -156,7 +156,7 @@ |
54 | } |
55 | logger.Tracef("lxc container created") |
56 | // Now symlink the config file into the restart directory. |
57 | - containerConfigFile := filepath.Join(lxcContainerDir, name, "config") |
58 | + containerConfigFile := filepath.Join(LxcContainerDir, name, "config") |
59 | if err := os.Symlink(containerConfigFile, restartSymlink(name)); err != nil { |
60 | return nil, err |
61 | } |
62 | @@ -181,7 +181,7 @@ |
63 | |
64 | func (manager *containerManager) StopContainer(instance instance.Instance) error { |
65 | name := string(instance.Id()) |
66 | - container := lxcObjectFactory.New(name) |
67 | + container := LxcObjectFactory.New(name) |
68 | // Remove the autostart link. |
69 | if err := os.Remove(restartSymlink(name)); err != nil { |
70 | logger.Errorf("failed to remove restart symlink: %v", err) |
71 | @@ -193,12 +193,12 @@ |
72 | } |
73 | |
74 | // Move the directory. |
75 | - logger.Tracef("create old container dir: %s", removedContainerDir) |
76 | - if err := os.MkdirAll(removedContainerDir, 0755); err != nil { |
77 | + logger.Tracef("create old container dir: %s", RemovedContainerDir) |
78 | + if err := os.MkdirAll(RemovedContainerDir, 0755); err != nil { |
79 | logger.Errorf("failed to create removed container directory: %v", err) |
80 | return err |
81 | } |
82 | - removedDir, err := uniqueDirectory(removedContainerDir, name) |
83 | + removedDir, err := uniqueDirectory(RemovedContainerDir, name) |
84 | if err != nil { |
85 | logger.Errorf("was not able to generate a unique directory: %v", err) |
86 | return err |
87 | @@ -211,7 +211,7 @@ |
88 | } |
89 | |
90 | func (manager *containerManager) ListContainers() (result []instance.Instance, err error) { |
91 | - containers, err := lxcObjectFactory.List() |
92 | + containers, err := LxcObjectFactory.List() |
93 | if err != nil { |
94 | logger.Errorf("failed getting all instances: %v", err) |
95 | return |
96 | @@ -235,17 +235,17 @@ |
97 | } |
98 | |
99 | func jujuContainerDirectory(containerName string) string { |
100 | - return filepath.Join(containerDir, containerName) |
101 | + return filepath.Join(ContainerDir, containerName) |
102 | } |
103 | |
104 | const internalLogDirTemplate = "%s/%s/rootfs/var/log/juju" |
105 | |
106 | func internalLogDir(containerName string) string { |
107 | - return fmt.Sprintf(internalLogDirTemplate, lxcContainerDir, containerName) |
108 | + return fmt.Sprintf(internalLogDirTemplate, LxcContainerDir, containerName) |
109 | } |
110 | |
111 | func restartSymlink(name string) string { |
112 | - return filepath.Join(lxcRestartDir, name+".conf") |
113 | + return filepath.Join(LxcRestartDir, name+".conf") |
114 | } |
115 | |
116 | const localConfig = `%s |
117 | |
118 | === modified file 'container/lxc/lxc_test.go' |
119 | --- container/lxc/lxc_test.go 2013-10-31 21:27:57 +0000 |
120 | +++ container/lxc/lxc_test.go 2013-11-11 10:57:52 +0000 |
121 | @@ -16,6 +16,7 @@ |
122 | "launchpad.net/loggo" |
123 | |
124 | "launchpad.net/juju-core/container/lxc" |
125 | + lxctesting "launchpad.net/juju-core/container/lxc/testing" |
126 | "launchpad.net/juju-core/environs" |
127 | "launchpad.net/juju-core/instance" |
128 | instancetest "launchpad.net/juju-core/instance/testing" |
129 | @@ -31,7 +32,7 @@ |
130 | } |
131 | |
132 | type LxcSuite struct { |
133 | - lxc.TestSuite |
134 | + lxctesting.TestSuite |
135 | } |
136 | |
137 | var _ = gc.Suite(&LxcSuite{}) |
138 | |
139 | === removed file 'container/lxc/test.go' |
140 | --- container/lxc/test.go 2013-09-22 23:29:33 +0000 |
141 | +++ container/lxc/test.go 1970-01-01 00:00:00 +0000 |
142 | @@ -1,40 +0,0 @@ |
143 | -// Copyright 2013 Canonical Ltd. |
144 | -// Licensed under the AGPLv3, see LICENCE file for details. |
145 | - |
146 | -// Functions defined in this file should *ONLY* be used for testing. These |
147 | -// functions are exported for testing purposes only, and shouldn't be called |
148 | -// from code that isn't in a test file. |
149 | - |
150 | -package lxc |
151 | - |
152 | -import ( |
153 | - gc "launchpad.net/gocheck" |
154 | - |
155 | - "launchpad.net/juju-core/container/lxc/mock" |
156 | - "launchpad.net/juju-core/testing/testbase" |
157 | -) |
158 | - |
159 | -// TestSuite replaces the lxc factory that the broker uses with a mock |
160 | -// implementation. |
161 | -type TestSuite struct { |
162 | - testbase.LoggingSuite |
163 | - Factory mock.ContainerFactory |
164 | - ContainerDir string |
165 | - RemovedDir string |
166 | - LxcDir string |
167 | - RestartDir string |
168 | -} |
169 | - |
170 | -func (s *TestSuite) SetUpTest(c *gc.C) { |
171 | - s.LoggingSuite.SetUpTest(c) |
172 | - s.ContainerDir = c.MkDir() |
173 | - s.PatchValue(&containerDir, s.ContainerDir) |
174 | - s.RemovedDir = c.MkDir() |
175 | - s.PatchValue(&removedContainerDir, s.RemovedDir) |
176 | - s.LxcDir = c.MkDir() |
177 | - s.PatchValue(&lxcContainerDir, s.LxcDir) |
178 | - s.RestartDir = c.MkDir() |
179 | - s.PatchValue(&lxcRestartDir, s.RestartDir) |
180 | - s.Factory = mock.MockFactory() |
181 | - s.PatchValue(&lxcObjectFactory, s.Factory) |
182 | -} |
183 | |
184 | === added directory 'container/lxc/testing' |
185 | === added file 'container/lxc/testing/test.go' |
186 | --- container/lxc/testing/test.go 1970-01-01 00:00:00 +0000 |
187 | +++ container/lxc/testing/test.go 2013-11-11 10:57:52 +0000 |
188 | @@ -0,0 +1,37 @@ |
189 | +// Copyright 2013 Canonical Ltd. |
190 | +// Licensed under the AGPLv3, see LICENCE file for details. |
191 | + |
192 | +package testing |
193 | + |
194 | +import ( |
195 | + gc "launchpad.net/gocheck" |
196 | + |
197 | + "launchpad.net/juju-core/container/lxc" |
198 | + "launchpad.net/juju-core/container/lxc/mock" |
199 | + "launchpad.net/juju-core/testing/testbase" |
200 | +) |
201 | + |
202 | +// TestSuite replaces the lxc factory that the broker uses with a mock |
203 | +// implementation. |
204 | +type TestSuite struct { |
205 | + testbase.LoggingSuite |
206 | + Factory mock.ContainerFactory |
207 | + ContainerDir string |
208 | + RemovedDir string |
209 | + LxcDir string |
210 | + RestartDir string |
211 | +} |
212 | + |
213 | +func (s *TestSuite) SetUpTest(c *gc.C) { |
214 | + s.LoggingSuite.SetUpTest(c) |
215 | + s.ContainerDir = c.MkDir() |
216 | + s.PatchValue(&lxc.ContainerDir, s.ContainerDir) |
217 | + s.RemovedDir = c.MkDir() |
218 | + s.PatchValue(&lxc.RemovedContainerDir, s.RemovedDir) |
219 | + s.LxcDir = c.MkDir() |
220 | + s.PatchValue(&lxc.LxcContainerDir, s.LxcDir) |
221 | + s.RestartDir = c.MkDir() |
222 | + s.PatchValue(&lxc.LxcRestartDir, s.RestartDir) |
223 | + s.Factory = mock.MockFactory() |
224 | + s.PatchValue(&lxc.LxcObjectFactory, s.Factory) |
225 | +} |
226 | |
227 | === modified file 'provider/local/environprovider_test.go' |
228 | --- provider/local/environprovider_test.go 2013-10-02 01:27:45 +0000 |
229 | +++ provider/local/environprovider_test.go 2013-11-11 10:57:52 +0000 |
230 | @@ -7,13 +7,13 @@ |
231 | gc "launchpad.net/gocheck" |
232 | "launchpad.net/loggo" |
233 | |
234 | - "launchpad.net/juju-core/container/lxc" |
235 | + lxctesting "launchpad.net/juju-core/container/lxc/testing" |
236 | "launchpad.net/juju-core/provider/local" |
237 | "launchpad.net/juju-core/testing" |
238 | ) |
239 | |
240 | type baseProviderSuite struct { |
241 | - lxc.TestSuite |
242 | + lxctesting.TestSuite |
243 | home *testing.FakeHome |
244 | restore func() |
245 | } |
246 | |
247 | === modified file 'worker/provisioner/lxc-broker_test.go' |
248 | --- worker/provisioner/lxc-broker_test.go 2013-10-31 21:36:40 +0000 |
249 | +++ worker/provisioner/lxc-broker_test.go 2013-11-11 10:57:52 +0000 |
250 | @@ -13,8 +13,8 @@ |
251 | |
252 | "launchpad.net/juju-core/agent" |
253 | "launchpad.net/juju-core/constraints" |
254 | - "launchpad.net/juju-core/container/lxc" |
255 | "launchpad.net/juju-core/container/lxc/mock" |
256 | + lxctesting "launchpad.net/juju-core/container/lxc/testing" |
257 | "launchpad.net/juju-core/environs" |
258 | "launchpad.net/juju-core/environs/config" |
259 | "launchpad.net/juju-core/instance" |
260 | @@ -31,7 +31,7 @@ |
261 | ) |
262 | |
263 | type lxcSuite struct { |
264 | - lxc.TestSuite |
265 | + lxctesting.TestSuite |
266 | events chan mock.Event |
267 | } |
268 |
Reviewers: mp+192411_ code.launchpad. net,
Message:
Please take a look.
Description:
Bug fix for lp:1243924
Bug fix for lp:1243924
https:/ /code.launchpad .net/~mattyw/ juju-core/ gocheck_ included_ in_build_ fix/+merge/ 192411
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/15690053/