Beispiel #1
0
func (s *configSuite) TestNamespaceRootNoSudo(c *gc.C) {
	restore := local.SetRootCheckFunction(func() bool { return true })
	defer restore()
	err := os.Setenv("USER", "root")
	c.Assert(err, gc.IsNil)
	testConfig := minimalConfig(c)
	c.Assert(local.ConfigNamespace(testConfig), gc.Equals, "root-test")
}
func (s *localJujuTestSuite) SetUpTest(c *gc.C) {
	s.baseProviderSuite.SetUpTest(c)
	// Construct the directories first.
	err := local.CreateDirs(c, minimalConfig(c))
	c.Assert(err, gc.IsNil)
	s.oldUpstartLocation = local.SetUpstartScriptLocation(c.MkDir())
	s.oldPath = os.Getenv("PATH")
	s.testPath = c.MkDir()
	os.Setenv("PATH", s.testPath+":"+s.oldPath)

	// Add in an admin secret
	s.Tests.TestConfig.Config["admin-secret"] = "sekrit"
	s.restoreRootCheck = local.SetRootCheckFunction(func() bool { return true })
	s.Tests.SetUpTest(c)
	s.dbServiceName = "juju-db-" + local.ConfigNamespace(s.Env.Config())
}