Merge lp:~axwalk/juju-core/local-dpkquery-isolation into lp:~go-bot/juju-core/trunk

Proposed by Andrew Wilkins
Status: Merged
Approved by: Ian Booth
Approved revision: no longer in the source branch.
Merged at revision: 2375
Proposed branch: lp:~axwalk/juju-core/local-dpkquery-isolation
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 54 lines (+11/-1)
2 files modified
provider/local/prereqs.go (+4/-1)
provider/local/prereqs_test.go (+7/-0)
To merge this branch: bzr merge lp:~axwalk/juju-core/local-dpkquery-isolation
Reviewer Review Type Date Requested Status
Ian Booth Approve
Review via email: mp+209169@code.launchpad.net

Commit message

provider/local: isolate tests from dpkg-query

The local provider uses dpkg-query to ensure
rsyslog-gnutls is available. This change
isolates the tests from the real dpgk-query.

https://codereview.appspot.com/71050043/

Description of the change

provider/local: isolate tests from dpkg-query

The local provider uses dpkg-query to ensure
rsyslog-gnutls is available. This change
isolates the tests from the real dpgk-query.

https://codereview.appspot.com/71050043/

To post a comment you must log in.
Revision history for this message
Andrew Wilkins (axwalk) wrote :

Reviewers: mp+209169_code.launchpad.net,

Message:
Please take a look.

Description:
provider/local: isolate tests from dpkg-query

The local provider uses dpkg-query to ensure
rsyslog-gnutls is available. This change
isolates the tests from the real dpgk-query.

https://code.launchpad.net/~axwalk/juju-core/local-dpkquery-isolation/+merge/209169

(do not edit description out of merge proposal)

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

Affected files (+13, -1 lines):
   A [revision details]
   M provider/local/prereqs.go
   M provider/local/prereqs_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: provider/local/prereqs.go
=== modified file 'provider/local/prereqs.go'
--- provider/local/prereqs.go 2014-02-28 07:27:59 +0000
+++ provider/local/prereqs.go 2014-03-04 04:38:17 +0000
@@ -67,6 +67,9 @@
  // unit testing.
  var lxclsPath = "lxc-ls"

+// isPackageInstalled is a variable to support testing.
+var isPackageInstalled = utils.IsPackageInstalled
+
  // defaultRsyslogGnutlsPath is the default path to the
  // rsyslog GnuTLS module. This is a variable only to
  // support unit testing.
@@ -143,7 +146,7 @@
  }

  func verifyRsyslogGnutls() error {
- if utils.IsPackageInstalled("rsyslog-gnutls") {
+ if isPackageInstalled("rsyslog-gnutls") {
    return nil
   }
   if utils.IsUbuntu() {

Index: provider/local/prereqs_test.go
=== modified file 'provider/local/prereqs_test.go'
--- provider/local/prereqs_test.go 2014-02-27 08:44:14 +0000
+++ provider/local/prereqs_test.go 2014-03-04 04:38:17 +0000
@@ -14,6 +14,7 @@
   "launchpad.net/juju-core/instance"
   "launchpad.net/juju-core/testing/testbase"
   "launchpad.net/juju-core/upstart"
+ "launchpad.net/juju-core/utils"
   "launchpad.net/juju-core/version"
  )

@@ -36,6 +37,11 @@
   // even when mongodb and lxc-ls can't be
   // found.
   lxclsPath = "/bin/true"
+
+ // Allow non-prereq tests to pass by default.
+ isPackageInstalled = func(packageName string) bool {
+ return true
+ }
  }

  func (s *prereqsSuite) SetUpTest(c *gc.C) {
@@ -55,6 +61,7 @@
   // simulate package installation query responses.
   err = os.Symlink("/bin/true", filepath.Join(s.tmpdir, "dpkg-query"))
   c.Assert(err, gc.IsNil)
+ s.PatchValue(&isPackageInstalled, utils.IsPackageInstalled)
  }

  func (*prereqsSuite) TestSupportedOS(c *gc.C) {

Revision history for this message
Ian Booth (wallyworld) wrote :
Revision history for this message
Ian Booth (wallyworld) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'provider/local/prereqs.go'
2--- provider/local/prereqs.go 2014-02-28 07:27:59 +0000
3+++ provider/local/prereqs.go 2014-03-04 04:41:52 +0000
4@@ -67,6 +67,9 @@
5 // unit testing.
6 var lxclsPath = "lxc-ls"
7
8+// isPackageInstalled is a variable to support testing.
9+var isPackageInstalled = utils.IsPackageInstalled
10+
11 // defaultRsyslogGnutlsPath is the default path to the
12 // rsyslog GnuTLS module. This is a variable only to
13 // support unit testing.
14@@ -143,7 +146,7 @@
15 }
16
17 func verifyRsyslogGnutls() error {
18- if utils.IsPackageInstalled("rsyslog-gnutls") {
19+ if isPackageInstalled("rsyslog-gnutls") {
20 return nil
21 }
22 if utils.IsUbuntu() {
23
24=== modified file 'provider/local/prereqs_test.go'
25--- provider/local/prereqs_test.go 2014-02-27 08:44:14 +0000
26+++ provider/local/prereqs_test.go 2014-03-04 04:41:52 +0000
27@@ -14,6 +14,7 @@
28 "launchpad.net/juju-core/instance"
29 "launchpad.net/juju-core/testing/testbase"
30 "launchpad.net/juju-core/upstart"
31+ "launchpad.net/juju-core/utils"
32 "launchpad.net/juju-core/version"
33 )
34
35@@ -36,6 +37,11 @@
36 // even when mongodb and lxc-ls can't be
37 // found.
38 lxclsPath = "/bin/true"
39+
40+ // Allow non-prereq tests to pass by default.
41+ isPackageInstalled = func(packageName string) bool {
42+ return true
43+ }
44 }
45
46 func (s *prereqsSuite) SetUpTest(c *gc.C) {
47@@ -55,6 +61,7 @@
48 // simulate package installation query responses.
49 err = os.Symlink("/bin/true", filepath.Join(s.tmpdir, "dpkg-query"))
50 c.Assert(err, gc.IsNil)
51+ s.PatchValue(&isPackageInstalled, utils.IsPackageInstalled)
52 }
53
54 func (*prereqsSuite) TestSupportedOS(c *gc.C) {

Subscribers

People subscribed via source and target branches

to status/vote changes: