github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/worker/uniter/runner/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  	jc "github.com/juju/testing/checkers"
     8  	gc "gopkg.in/check.v1"
     9  
    10  	"github.com/juju/juju/worker/uniter/runner/debug"
    11  )
    12  
    13  type DebugHooksCommonSuite struct{}
    14  
    15  var _ = gc.Suite(&DebugHooksCommonSuite{})
    16  
    17  // TestHooksContext tests the behaviour of HooksContext.
    18  func (*DebugHooksCommonSuite) TestHooksContext(c *gc.C) {
    19  	ctx := debug.NewHooksContext("foo/8")
    20  	c.Assert(ctx.Unit, gc.Equals, "foo/8")
    21  	c.Assert(ctx.FlockDir, gc.Equals, "/tmp")
    22  	ctx.FlockDir = "/var/lib/juju"
    23  	c.Assert(ctx.ClientFileLock(), jc.SamePath, "/var/lib/juju/juju-unit-foo-8-debug-hooks")
    24  	c.Assert(ctx.ClientExitFileLock(), jc.SamePath, "/var/lib/juju/juju-unit-foo-8-debug-hooks-exit")
    25  }