launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/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  	gc "launchpad.net/gocheck"
     8  	"testing"
     9  
    10  	"launchpad.net/juju-core/worker/uniter/debug"
    11  )
    12  
    13  type DebugHooksCommonSuite struct{}
    14  
    15  var _ = gc.Suite(&DebugHooksCommonSuite{})
    16  
    17  func TestPackage(t *testing.T) {
    18  	gc.TestingT(t)
    19  }
    20  
    21  // TestCommonScript tests the behaviour of HooksContext.
    22  func (*DebugHooksCommonSuite) TestHooksContext(c *gc.C) {
    23  	ctx := debug.NewHooksContext("foo/8")
    24  	c.Assert(ctx.Unit, gc.Equals, "foo/8")
    25  	c.Assert(ctx.FlockDir, gc.Equals, "/tmp")
    26  	ctx.FlockDir = "/var/lib/juju"
    27  	c.Assert(ctx.ClientFileLock(), gc.Equals, "/var/lib/juju/juju-unit-foo-8-debug-hooks")
    28  	c.Assert(ctx.ClientExitFileLock(), gc.Equals, "/var/lib/juju/juju-unit-foo-8-debug-hooks-exit")
    29  }