Merge lp:~axwalk/juju-core/lp1206195-mock-deployer-init-dir into lp:~go-bot/juju-core/trunk
Proposed by
Andrew Wilkins
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Andrew Wilkins | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 2337 | ||||
Proposed branch: | lp:~axwalk/juju-core/lp1206195-mock-deployer-init-dir | ||||
Merge into: | lp:~go-bot/juju-core/trunk | ||||
Diff against target: |
74 lines (+21/-2) 3 files modified
cmd/jujud/machine_test.go (+0/-1) cmd/jujud/main_test.go (+16/-0) worker/deployer/simple.go (+5/-1) |
||||
To merge this branch: | bzr merge lp:~axwalk/juju-core/lp1206195-mock-deployer-init-dir | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+205907@code.launchpad.net |
Commit message
cmd/jujud: override deployer init-dir in tests
worker/deployer is (mostly) hard coded to look for unit
jobs in /etc/init, and recall/remove those it doesn't know
about.
The worker/deployer tests specify a temporary directory
instead of the default; this CL updates cmd/jujud tests
to do the same.
Fixes lp:1206195
Description of the change
cmd/jujud: override deployer init-dir in tests
worker/deployer is (mostly) hard coded to look for unit
jobs in /etc/init, and recall/remove those it doesn't know
about.
The worker/deployer tests specify a temporary directory
instead of the default; this CL updates cmd/jujud tests
to do the same.
Fixes lp:1206195
To post a comment you must log in.
Reviewers: mp+205907_ code.launchpad. net,
Message:
Please take a look.
Description:
cmd/jujud: override deployer init-dir in tests
worker/deployer is (mostly) hard coded to look for unit
jobs in /etc/init, and recall/remove those it doesn't know
about.
The worker/deployer tests specify a temporary directory
instead of the default; this CL updates cmd/jujud tests
to do the same.
Fixes lp:1206195
https:/ /code.launchpad .net/~axwalk/ juju-core/ lp1206195- mock-deployer- init-dir/ +merge/ 205907
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/61610044/
Affected files (+21, -2 lines): jujud/machine_ test.go jujud/main_ test.go deployer/ simple. go
[revision details]
cmd/
cmd/
worker/
Index: [revision details] 20140212024202- e5i2ten0rh1ph2d 2
=== 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-
+New revision: <email address hidden>
Index: cmd/jujud/ machine_ test.go machine_ test.go' machine_ test.go 2014-01-31 05:38:42 +0000 machine_ test.go 2014-02-12 07:24:47 +0000
=== modified file 'cmd/jujud/
--- cmd/jujud/
+++ cmd/jujud/
@@ -181,7 +181,6 @@
}
func (s *MachineSuite) TestDyingMachine(c *gc.C) {
- c.Skip("Disabled as breaks test isolation somehow, see lp:1206195")
m, _, _ := s.primeAgent(c, state.JobHostUnits)
a := s.newAgent(c, m)
done := make(chan error)
Index: cmd/jujud/ main_test. go main_test. go' main_test. go 2014-01-14 05:33:34 +0000 main_test. go 2014-02-12 07:24:47 +0000 net/juju- core/cmd" net/juju- core/environs" net/juju- core/testing" net/juju- core/worker/ deployer" net/juju- core/worker/ uniter/ jujuc"
=== modified file 'cmd/jujud/
--- cmd/jujud/
+++ cmd/jujud/
@@ -20,11 +20,20 @@
"launchpad.
"launchpad.
"launchpad.
+ "launchpad.
"launchpad.
)
var caCertFile string
+func mkdtemp(prefix string) string {
+ d, err := ioutil.TempDir("", prefix)
+ if err != nil {
+ panic(err)
+ }
+ return d
+}
+
func mktemp(prefix string, content string) string {
f, err := ioutil.TempFile("", prefix)
if err != nil {
@@ -39,6 +48,11 @@
}
func TestPackage(t *stdtesting.T) { "juju-worker- deployer" )
+ // Change the default init dir in worker/deployer,
+ // so the deployer doesn't try to remove upstart
+ // jobs from tests.
+ deployer.InitDir = mkdtemp(
+
// Change the path to "juju-run", so that the
// tests don't try to write to /usr/local/bin.
jujuRun = mktemp("juju-run", "")
Index: worker/ deployer/ simple. go deployer/ simple. go' deployer/ simple. go 2014-01-22 22:48:54 +0000 deployer/ simple. go 2014-02-12 07:24:47 +0000 net/juju- core/version"
=== modified file 'worker/
--- worker/
+++ worker/
@@ -21,6 +21,10 @@
"launchpad.
)
+// InitDir is the default upstart init directory. DeployerConnect ionValues, error)
+// This is a var so it can be overridden by tests.
+var InitDir = "/etc/init"
+
// APICalls defines the interface to the API that the simple context needs.
type APICalls interface {
ConnectionInfo() (params.
@@ -65,7 +69,7 @@
return &SimpleContext{
api: api,
agentConfig: agentConfig,...