Merge lp:~axwalk/juju-core/cmd-jujud-machinetest-fakehome 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: 2211
Proposed branch: lp:~axwalk/juju-core/cmd-jujud-machinetest-fakehome
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 25 lines (+4/-4)
1 file modified
cmd/jujud/machine_test.go (+4/-4)
To merge this branch: bzr merge lp:~axwalk/juju-core/cmd-jujud-machinetest-fakehome
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+201709@code.launchpad.net

Commit message

cmd/jujud: fake $HOME for all machine agent tests

Also, set the "SSHUser" to "", so the authenticationworker
does not attempt to read/write ~ubuntu/.ssh/authorized_keys.

https://codereview.appspot.com/52260044/

Description of the change

cmd/jujud: fake $HOME for all machine agent tests

Also, set the "SSHUser" to "", so the authenticationworker
does not attempt to read/write ~ubuntu/.ssh/authorized_keys.

https://codereview.appspot.com/52260044/

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

Reviewers: mp+201709_code.launchpad.net,

Message:
Please take a look.

Description:
cmd/jujud: fake $HOME for all machine agent tests

Also, set the "SSHUser" to "", so the authenticationworker
does not attempt to read/write ~ubuntu/.ssh/authorized_keys.

https://code.launchpad.net/~axwalk/juju-core/cmd-jujud-machinetest-fakehome/+merge/201709

(do not edit description out of merge proposal)

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

Affected files (+6, -4 lines):
   A [revision details]
   M cmd/jujud/machine_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-20140115023645-jcncxp07j62jmxrb
+New revision: <email address hidden>

Index: cmd/jujud/machine_test.go
=== modified file 'cmd/jujud/machine_test.go'
--- cmd/jujud/machine_test.go 2014-01-14 05:33:34 +0000
+++ cmd/jujud/machine_test.go 2014-01-15 03:20:41 +0000
@@ -63,6 +63,10 @@
   s.agentSuite.SetUpTest(c)
   s.TestSuite.SetUpTest(c)
   os.Remove(jujuRun) // ignore error; may not exist
+ // Fake $HOME, and ssh user to avoid touching
~ubuntu/.ssh/authorized_keys.
+ fakeHome := coretesting.MakeEmptyFakeHomeWithoutJuju(c)
+ s.AddCleanup(func(*gc.C) { fakeHome.Restore() })
+ s.PatchValue(&authenticationworker.SSHUser, "")
  }

  func (s *MachineSuite) TearDownTest(c *gc.C) {
@@ -577,10 +581,6 @@
  }

  func (s *MachineSuite) TestMachineAgentRunsAuthorisedKeysWorker(c *gc.C) {
- fakeHome := coretesting.MakeEmptyFakeHomeWithoutJuju(c)
- s.AddCleanup(func(*gc.C) { fakeHome.Restore() })
- s.PatchValue(&authenticationworker.SSHUser, "")
-
   // Start the machine agent.
   m, _, _ := s.primeAgent(c, state.JobHostUnits)
   a := s.newAgent(c, m)

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/jujud/machine_test.go'
2--- cmd/jujud/machine_test.go 2014-01-14 05:33:34 +0000
3+++ cmd/jujud/machine_test.go 2014-01-15 03:23:18 +0000
4@@ -63,6 +63,10 @@
5 s.agentSuite.SetUpTest(c)
6 s.TestSuite.SetUpTest(c)
7 os.Remove(jujuRun) // ignore error; may not exist
8+ // Fake $HOME, and ssh user to avoid touching ~ubuntu/.ssh/authorized_keys.
9+ fakeHome := coretesting.MakeEmptyFakeHomeWithoutJuju(c)
10+ s.AddCleanup(func(*gc.C) { fakeHome.Restore() })
11+ s.PatchValue(&authenticationworker.SSHUser, "")
12 }
13
14 func (s *MachineSuite) TearDownTest(c *gc.C) {
15@@ -577,10 +581,6 @@
16 }
17
18 func (s *MachineSuite) TestMachineAgentRunsAuthorisedKeysWorker(c *gc.C) {
19- fakeHome := coretesting.MakeEmptyFakeHomeWithoutJuju(c)
20- s.AddCleanup(func(*gc.C) { fakeHome.Restore() })
21- s.PatchValue(&authenticationworker.SSHUser, "")
22-
23 // Start the machine agent.
24 m, _, _ := s.primeAgent(c, state.JobHostUnits)
25 a := s.newAgent(c, m)

Subscribers

People subscribed via source and target branches

to status/vote changes: