github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/worker/uniter/debug/common_test.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package debug_test 5 6 import ( 7 "testing" 8 9 gc "launchpad.net/gocheck" 10 11 "launchpad.net/juju-core/worker/uniter/debug" 12 ) 13 14 type DebugHooksCommonSuite struct{} 15 16 var _ = gc.Suite(&DebugHooksCommonSuite{}) 17 18 func TestPackage(t *testing.T) { 19 gc.TestingT(t) 20 } 21 22 // TestCommonScript tests the behaviour of HooksContext. 23 func (*DebugHooksCommonSuite) TestHooksContext(c *gc.C) { 24 ctx := debug.NewHooksContext("foo/8") 25 c.Assert(ctx.Unit, gc.Equals, "foo/8") 26 c.Assert(ctx.FlockDir, gc.Equals, "/tmp") 27 ctx.FlockDir = "/var/lib/juju" 28 c.Assert(ctx.ClientFileLock(), gc.Equals, "/var/lib/juju/juju-unit-foo-8-debug-hooks") 29 c.Assert(ctx.ClientExitFileLock(), gc.Equals, "/var/lib/juju/juju-unit-foo-8-debug-hooks-exit") 30 }