func (s *commonMachineSuite) SetUpTest(c *gc.C) { 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, "") testpath := c.MkDir() s.PatchEnvPathPrepend(testpath) // mock out the start method so we can fake install services without sudo fakeCmd(filepath.Join(testpath, "start")) fakeCmd(filepath.Join(testpath, "stop")) s.PatchValue(&upstart.InitDir, c.MkDir()) s.singularRecord = &singularRunnerRecord{} testing.PatchValue(&newSingularRunner, s.singularRecord.newSingularRunner) testing.PatchValue(&peergrouperNew, func(st *state.State) (worker.Worker, error) { return newDummyWorker(), nil }) s.fakeEnsureMongo = fakeEnsure{} s.PatchValue(&ensureMongoServer, s.fakeEnsureMongo.fakeEnsureMongo) s.PatchValue(&maybeInitiateMongoServer, s.fakeEnsureMongo.fakeInitiateMongo) }
func (s *AuthorisedKeysKeysSuite) SetUpTest(c *gc.C) { s.LoggingSuite.SetUpTest(c) fakeHome := coretesting.MakeEmptyFakeHomeWithoutJuju(c) s.AddCleanup(func(*gc.C) { fakeHome.Restore() }) }