Merge lp:~frankban/golxc/fix-logging-suite into lp:golxc

Proposed by Francesco Banconi on 2014-05-28
Status: Merged
Merged at revision: 9
Proposed branch: lp:~frankban/golxc/fix-logging-suite
Merge into: lp:golxc
Diff against target: 51 lines (+11/-3)
1 file modified
golxc_test.go (+11/-3)
To merge this branch: bzr merge lp:~frankban/golxc/fix-logging-suite
Reviewer Review Type Date Requested Status
Juju Engineering 2014-05-28 Pending
Review via email: mp+221210@code.launchpad.net

Commit message

Replace LoggingSuite with IsolationSuite.

Description of the change

Replace LoggingSuite with IsolationSuite.

The logging package no longer exist in github.com/juju/testing.

https://codereview.appspot.com/92660046/

To post a comment you must log in.
Francesco Banconi (frankban) wrote :

Reviewers: mp+221210_code.launchpad.net,

Message:
Please take a look.

Description:
Replace LoggingSuite with IsolationSuite.

The logging package no longer exist in github.com/juju/testing.

https://code.launchpad.net/~frankban/golxc/fix-logging-suite/+merge/221210

(do not edit description out of merge proposal)

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

Affected files (+6, -3 lines):
   A [revision details]
   M golxc_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: <email address hidden>
+New revision:
<email address hidden>

Index: golxc_test.go
=== modified file 'golxc_test.go'
--- golxc_test.go 2014-03-11 00:34:54 +0000
+++ golxc_test.go 2014-05-28 11:48:02 +0000
@@ -11,7 +11,6 @@

   "github.com/juju/testing"
   jc "github.com/juju/testing/checkers"
- "github.com/juju/testing/logging"
   . "launchpad.net/gocheck"

   "launchpad.net/golxc"
@@ -20,7 +19,7 @@
  var lxcfile = `# MIRROR to be used by ubuntu template at container
creation:
  # Leaving it undefined is fine
  #MIRROR="http://archive.ubuntu.com/ubuntu"
-# or
+# or
  #MIRROR="http://<host-ip-addr>:3142/archive.ubuntu.com/ubuntu"

  # LXC_AUTO - whether or not to start containers symlinked under
@@ -357,13 +356,14 @@
  }

  type commandArgs struct {
- logging.LoggingSuite
+ testing.IsolationSuite
  }

  var _ = Suite(&commandArgs{})

  func (s *commandArgs) TestCreateArgs(c *C) {
   s.PatchValue(&golxc.ContainerDir, c.MkDir())
+ s.PatchEnvironment("PATH", "/usr/bin") // Required by lxc-create -> tee.
   testing.PatchExecutableAsEchoArgs(c, s, "lxc-create")

   factory := golxc.Factory()
@@ -386,6 +386,7 @@
  func (s *commandArgs) TestCloneArgs(c *C) {
   dir := c.MkDir()
   s.PatchValue(&golxc.ContainerDir, dir)
+ s.PatchEnvironment("PATH", "/usr/bin") // Required by lxc-create -> tee.
   // Patch lxc-info too as clone checks to see if it is running.
   testing.PatchExecutableAsEchoArgs(c, s, "lxc-info")
   testing.PatchExecutableAsEchoArgs(c, s, "lxc-clone")

lp:~frankban/golxc/fix-logging-suite updated on 2014-05-28
10. By Francesco Banconi on 2014-05-28

Save the original path.

Martin Packman (gz) wrote :

LGTM. At least is explict about leaking your PATH in.

https://codereview.appspot.com/92660046/

Francesco Banconi (frankban) wrote :

*** Submitted:

Replace LoggingSuite with IsolationSuite.

The logging package no longer exist in github.com/juju/testing.

R=gz
CC=
https://codereview.appspot.com/92660046

https://codereview.appspot.com/92660046/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'golxc_test.go'
2--- golxc_test.go 2014-03-11 00:34:54 +0000
3+++ golxc_test.go 2014-05-28 12:05:23 +0000
4@@ -11,7 +11,6 @@
5
6 "github.com/juju/testing"
7 jc "github.com/juju/testing/checkers"
8- "github.com/juju/testing/logging"
9 . "launchpad.net/gocheck"
10
11 "launchpad.net/golxc"
12@@ -20,7 +19,7 @@
13 var lxcfile = `# MIRROR to be used by ubuntu template at container creation:
14 # Leaving it undefined is fine
15 #MIRROR="http://archive.ubuntu.com/ubuntu"
16-# or
17+# or
18 #MIRROR="http://<host-ip-addr>:3142/archive.ubuntu.com/ubuntu"
19
20 # LXC_AUTO - whether or not to start containers symlinked under
21@@ -357,13 +356,21 @@
22 }
23
24 type commandArgs struct {
25- logging.LoggingSuite
26+ testing.IsolationSuite
27+ originalPath string
28 }
29
30 var _ = Suite(&commandArgs{})
31
32+func (s *commandArgs) SetUpSuite(c *C) {
33+ // lxc-create requires the PATH to be set.
34+ s.originalPath = os.Getenv("PATH")
35+ s.IsolationSuite.SetUpSuite(c)
36+}
37+
38 func (s *commandArgs) TestCreateArgs(c *C) {
39 s.PatchValue(&golxc.ContainerDir, c.MkDir())
40+ s.PatchEnvironment("PATH", s.originalPath)
41 testing.PatchExecutableAsEchoArgs(c, s, "lxc-create")
42
43 factory := golxc.Factory()
44@@ -386,6 +393,7 @@
45 func (s *commandArgs) TestCloneArgs(c *C) {
46 dir := c.MkDir()
47 s.PatchValue(&golxc.ContainerDir, dir)
48+ s.PatchEnvironment("PATH", s.originalPath)
49 // Patch lxc-info too as clone checks to see if it is running.
50 testing.PatchExecutableAsEchoArgs(c, s, "lxc-info")
51 testing.PatchExecutableAsEchoArgs(c, s, "lxc-clone")

Subscribers

People subscribed via source and target branches