Code review comment for lp:~axwalk/juju-core/cmd-jujud-machinetest-fakehome

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)

« Back to merge proposal