Exemple #1
0
func (s *wrenchSuite) SetUpTest(c *gc.C) {
	s.BaseSuite.SetUpTest(c)
	// BaseSuite turns off wrench so restore the non-testing default.
	wrench.SetEnabled(true)
	c.Assert(loggo.RegisterWriter("wrench-tests", &s.logWriter), gc.IsNil)
	s.AddCleanup(func(*gc.C) {
		s.logWriter.Clear()
		loggo.RemoveWriter("wrench-tests")
		// Ensure the wrench is turned off when these tests are done.
		wrench.SetEnabled(false)
	})
}
Exemple #2
0
func (s *BaseSuite) SetUpSuite(c *gc.C) {
	wrench.SetEnabled(false)
	s.CleanupSuite.SetUpSuite(c)
	s.LoggingSuite.SetUpSuite(c)
	// JujuOSEnvSuite does not have a suite setup.
	s.PatchValue(&utils.OutgoingAccessAllowed, false)
}
Exemple #3
0
func (s *wrenchSuite) TestSetEnabled(c *gc.C) {
	s.createWrenchDir(c)
	s.createWrenchFile(c, "foo", "bar")

	// Starts enabled.
	c.Assert(wrench.IsEnabled(), jc.IsTrue)
	c.Assert(wrench.IsActive("foo", "bar"), jc.IsTrue)

	// Disable.
	c.Assert(wrench.SetEnabled(false), jc.IsTrue)
	c.Assert(wrench.IsEnabled(), jc.IsFalse)
	c.Assert(wrench.IsActive("foo", "bar"), jc.IsFalse)

	// Enable again.
	c.Assert(wrench.SetEnabled(true), jc.IsFalse)
	c.Assert(wrench.IsEnabled(), jc.IsTrue)
	c.Assert(wrench.IsActive("foo", "bar"), jc.IsTrue)
}
Exemple #4
0
func (s *BaseSuite) SetUpSuite(c *gc.C) {
	wrench.SetEnabled(false)
	s.CleanupSuite.SetUpSuite(c)
	s.LoggingSuite.SetUpSuite(c)
	// JujuOSEnvSuite does not have a suite setup.
	s.PatchValue(&utils.OutgoingAccessAllowed, false)
	// LTS-dependent requires new entry upon new LTS release.
	s.oldLtsForTesting = series.SetLatestLtsForTesting("xenial")
}
Exemple #5
0
func (s *wrenchSuite) SetUpTest(c *gc.C) {
	s.BaseSuite.SetUpTest(c)
	// BaseSuite turns off wrench so restore the non-testing default.
	wrench.SetEnabled(true)
	c.Assert(loggo.RegisterWriter("wrench-tests", &s.logWriter, loggo.TRACE), gc.IsNil)
	s.AddCleanup(func(*gc.C) {
		s.logWriter.Clear()
		loggo.RemoveWriter("wrench-tests")
	})
}
Exemple #6
0
func (s *wrenchSuite) TearDownSuite(c *gc.C) {
	s.BaseSuite.TearDownSuite(c)
	// Ensure the wrench is turned off when these tests are done.
	wrench.SetEnabled(false)
}