Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(107)

Unified Diff: worker/uniter/uniter_test.go

Issue 6501106: environs: remove VarDir global
Patch Set: environs: remove VarDir global Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « worker/uniter/uniter.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: worker/uniter/uniter_test.go
=== modified file 'worker/uniter/uniter_test.go'
--- worker/uniter/uniter_test.go 2012-09-06 06:41:36 +0000
+++ worker/uniter/uniter_test.go 2012-09-12 15:19:08 +0000
@@ -33,7 +33,7 @@
type UniterSuite struct {
testing.JujuConnSuite
coretesting.HTTPSuite
- varDir string
+ dataDir string
oldPath string
}
@@ -42,9 +42,8 @@
func (s *UniterSuite) SetUpSuite(c *C) {
s.JujuConnSuite.SetUpSuite(c)
s.HTTPSuite.SetUpSuite(c)
- s.varDir = c.MkDir()
- environs.VarDir = s.varDir // it's restored by JujuConnSuite.
- toolsDir := environs.AgentToolsDir("unit-u-0")
+ s.dataDir = c.MkDir()
+ toolsDir := environs.AgentToolsDir(s.dataDir, "unit-u-0")
err := os.MkdirAll(toolsDir, 0755)
c.Assert(err, IsNil)
cmd := exec.Command("go", "build", "launchpad.net/juju-core/cmd/jujuc")
@@ -62,7 +61,7 @@
func (s *UniterSuite) SetUpTest(c *C) {
s.JujuConnSuite.SetUpTest(c)
- environs.VarDir = s.varDir
+ s.HTTPSuite.SetUpTest(c)
}
func (s *UniterSuite) TearDownTest(c *C) {
@@ -72,7 +71,6 @@
func (s *UniterSuite) Reset(c *C) {
s.JujuConnSuite.Reset(c)
- environs.VarDir = s.varDir
}
type uniterTest struct {
@@ -89,14 +87,15 @@
}
type context struct {
- id int
- path string
- st *state.State
- charms coretesting.ResponseMap
- hooks []string
- svc *state.Service
- unit *state.Unit
- uniter *uniter.Uniter
+ id int
+ path string
+ dataDir string
+ st *state.State
+ charms coretesting.ResponseMap
+ hooks []string
+ svc *state.Service
+ unit *state.Unit
+ uniter *uniter.Uniter
}
var goodHook = `
@@ -259,7 +258,7 @@
}
func (s *UniterSuite) TestUniter(c *C) {
- unitDir := filepath.Join(environs.VarDir, "units", "u-0")
+ unitDir := filepath.Join(s.dataDir, "units", "u-0")
for i, t := range uniterTests {
if i != 0 {
s.Reset(c)
@@ -269,10 +268,11 @@
}
c.Logf("\ntest %d: %s\n", i, t.summary)
ctx := &context{
- id: i,
- path: unitDir,
- st: s.State,
- charms: coretesting.ResponseMap{},
+ id: i,
+ path: unitDir,
+ dataDir: s.dataDir,
+ st: s.State,
+ charms: coretesting.ResponseMap{},
}
for i, s := range t.steps {
c.Logf("step %d", i)
@@ -383,7 +383,7 @@
if ctx.uniter != nil {
panic("don't start two uniters!")
}
- u, err := uniter.NewUniter(ctx.st, "u/0")
+ u, err := uniter.NewUniter(ctx.st, "u/0", ctx.dataDir)
if s.err == "" {
c.Assert(err, IsNil)
ctx.uniter = u
« no previous file with comments | « worker/uniter/uniter.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b