github.com/mattyw/juju@v0.0.0-20140610034352-732aecd63861/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  	"github.com/juju/juju/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  // TestHooksContext 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  }