Skip to content

Commit

Permalink
Replace LoggingSuite with BaseSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyworld committed May 20, 2014
1 parent 9164073 commit f8bcd3f
Show file tree
Hide file tree
Showing 122 changed files with 339 additions and 433 deletions.
4 changes: 2 additions & 2 deletions agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (
"launchpad.net/juju-core/state"
"launchpad.net/juju-core/state/api"
"launchpad.net/juju-core/state/api/params"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/version"
)

type suite struct {
testbase.LoggingSuite
testing.BaseSuite
}

var _ = gc.Suite(&suite{})
Expand Down
11 changes: 5 additions & 6 deletions agent/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,35 @@ import (
"launchpad.net/juju-core/state"
"launchpad.net/juju-core/state/api/params"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/utils"
"launchpad.net/juju-core/version"
)

type bootstrapSuite struct {
testbase.LoggingSuite
testing.BaseSuite
testing.MgoSuite
}

var _ = gc.Suite(&bootstrapSuite{})

func (s *bootstrapSuite) SetUpSuite(c *gc.C) {
s.LoggingSuite.SetUpSuite(c)
s.BaseSuite.SetUpSuite(c)
s.MgoSuite.SetUpSuite(c)
}

func (s *bootstrapSuite) TearDownSuite(c *gc.C) {
s.MgoSuite.TearDownSuite(c)
s.LoggingSuite.TearDownSuite(c)
s.BaseSuite.TearDownSuite(c)
}

func (s *bootstrapSuite) SetUpTest(c *gc.C) {
s.LoggingSuite.SetUpTest(c)
s.BaseSuite.SetUpTest(c)
s.MgoSuite.SetUpTest(c)
}

func (s *bootstrapSuite) TearDownTest(c *gc.C) {
s.MgoSuite.TearDownTest(c)
s.LoggingSuite.TearDownTest(c)
s.BaseSuite.TearDownTest(c)
}

func (s *bootstrapSuite) TestInitializeState(c *gc.C) {
Expand Down
4 changes: 2 additions & 2 deletions agent/format-1.16_whitebox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (
jc "github.com/juju/testing/checkers"

gc "launchpad.net/gocheck"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/utils"
"launchpad.net/juju-core/version"
)

type format_1_16Suite struct {
testbase.LoggingSuite
testing.BaseSuite
}

var _ = gc.Suite(&format_1_16Suite{})
Expand Down
4 changes: 2 additions & 2 deletions agent/format-1.18_whitebox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (

gc "launchpad.net/gocheck"
"launchpad.net/juju-core/state/api/params"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/utils"
"launchpad.net/juju-core/version"
)

type format_1_18Suite struct {
testbase.LoggingSuite
testing.BaseSuite
}

var _ = gc.Suite(&format_1_18Suite{})
Expand Down
4 changes: 2 additions & 2 deletions agent/format_whitebox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
gc "launchpad.net/gocheck"

"launchpad.net/juju-core/state/api/params"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/version"
)

type formatSuite struct {
testbase.LoggingSuite
testing.BaseSuite
}

var _ = gc.Suite(&formatSuite{})
Expand Down
4 changes: 2 additions & 2 deletions agent/identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
gc "launchpad.net/gocheck"

"launchpad.net/juju-core/state/api/params"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/version"
)

type identitySuite struct {
testbase.LoggingSuite
testing.BaseSuite
mongodConfigPath string
mongodPath string
}
Expand Down
6 changes: 3 additions & 3 deletions agent/mongo/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"launchpad.net/juju-core/instance"
"launchpad.net/juju-core/state/api/params"
"launchpad.net/juju-core/testing/testbase"
coretesting "launchpad.net/juju-core/testing"
"launchpad.net/juju-core/upstart"
"launchpad.net/juju-core/utils"
"launchpad.net/juju-core/version"
Expand All @@ -29,7 +29,7 @@ import (
func Test(t *stdtesting.T) { gc.TestingT(t) }

type MongoSuite struct {
testbase.LoggingSuite
coretesting.BaseSuite
mongodConfigPath string
mongodPath string

Expand All @@ -50,7 +50,7 @@ var testInfo = params.StateServingInfo{
}

func (s *MongoSuite) SetUpTest(c *gc.C) {
s.LoggingSuite.SetUpTest(c)
s.BaseSuite.SetUpTest(c)
// Try to make sure we don't execute any commands accidentally.
s.PatchEnvironment("PATH", "")

Expand Down
3 changes: 1 addition & 2 deletions agent/mongo/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import (
gc "launchpad.net/gocheck"

coretesting "launchpad.net/juju-core/testing"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/upstart"
)

type EnsureAdminSuite struct {
testbase.LoggingSuite
coretesting.BaseSuite
}

var _ = gc.Suite(&EnsureAdminSuite{})
Expand Down
5 changes: 2 additions & 3 deletions agent/tools/diskmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

agenttools "launchpad.net/juju-core/agent/tools"
coretesting "launchpad.net/juju-core/testing"
"launchpad.net/juju-core/testing/testbase"
coretools "launchpad.net/juju-core/tools"
"launchpad.net/juju-core/version"
)
Expand All @@ -23,13 +22,13 @@ var _ = gc.Suite(&DiskManagerSuite{})
var _ agenttools.ToolsManager = (*agenttools.DiskManager)(nil)

type DiskManagerSuite struct {
testbase.LoggingSuite
coretesting.BaseSuite
dataDir string
manager agenttools.ToolsManager
}

func (s *DiskManagerSuite) SetUpTest(c *gc.C) {
s.LoggingSuite.SetUpTest(c)
s.BaseSuite.SetUpTest(c)
s.dataDir = c.MkDir()
s.manager = agenttools.NewDiskManager(s.dataDir)
}
Expand Down
4 changes: 2 additions & 2 deletions agent/tools/tools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import (
)

type ToolsSuite struct {
testbase.LoggingSuite
testing.BaseSuite
dataDir string
}

var _ = gc.Suite(&ToolsSuite{})

func (t *ToolsSuite) SetUpTest(c *gc.C) {
t.LoggingSuite.SetUpTest(c)
t.BaseSuite.SetUpTest(c)
t.dataDir = c.MkDir()
}

Expand Down
10 changes: 5 additions & 5 deletions bzr/bzr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import (
"os"
"os/exec"
"path/filepath"
"testing"
stdtesting "testing"

gc "launchpad.net/gocheck"

"launchpad.net/juju-core/bzr"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/testing"
)

func Test(t *testing.T) {
func Test(t *stdtesting.T) {
gc.TestingT(t)
}

var _ = gc.Suite(&BzrSuite{})

type BzrSuite struct {
testbase.LoggingSuite
testing.BaseSuite
b *bzr.Branch
}

Expand All @@ -32,7 +32,7 @@ email = testing <[email protected]>
`

func (s *BzrSuite) SetUpTest(c *gc.C) {
s.LoggingSuite.SetUpTest(c)
s.BaseSuite.SetUpTest(c)
bzrdir := c.MkDir()
s.PatchEnvironment("BZR_HOME", bzrdir)
err := os.Mkdir(filepath.Join(bzrdir, ".bazaar"), 0755)
Expand Down
3 changes: 1 addition & 2 deletions charm/dir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ import (

"launchpad.net/juju-core/charm"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/testing/testbase"
)

type DirSuite struct {
testbase.LoggingSuite
testing.BaseSuite
}

var _ = gc.Suite(&DirSuite{})
Expand Down
17 changes: 7 additions & 10 deletions charm/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ import (
charmtesting "launchpad.net/juju-core/charm/testing"
env_config "launchpad.net/juju-core/environs/config"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/testing/testbase"
)

type StoreSuite struct {
testbase.LoggingSuite
testing.BaseSuite
server *charmtesting.MockStore
store *charm.CharmStore
}

var _ = gc.Suite(&StoreSuite{})

func (s *StoreSuite) SetUpSuite(c *gc.C) {
s.LoggingSuite.SetUpSuite(c)
s.BaseSuite.SetUpSuite(c)
s.server = charmtesting.NewMockStore(c, map[string]int{
"cs:series/good": 23,
"cs:series/unwise": 23,
Expand All @@ -37,7 +36,7 @@ func (s *StoreSuite) SetUpSuite(c *gc.C) {
}

func (s *StoreSuite) SetUpTest(c *gc.C) {
s.LoggingSuite.SetUpTest(c)
s.BaseSuite.SetUpTest(c)
s.PatchValue(&charm.CacheDir, c.MkDir())
s.store = charm.NewStore(s.server.Address())
s.server.Downloads = nil
Expand All @@ -48,11 +47,9 @@ func (s *StoreSuite) SetUpTest(c *gc.C) {
s.server.InfoRequestCountNoStats = 0
}

// Uses the TearDownTest from testbase.LoggingSuite

func (s *StoreSuite) TearDownSuite(c *gc.C) {
s.server.Close()
s.LoggingSuite.TearDownSuite(c)
s.BaseSuite.TearDownSuite(c)
}

func (s *StoreSuite) TestMissing(c *gc.C) {
Expand Down Expand Up @@ -229,7 +226,7 @@ func (s *StoreSuite) TestInfoTestModeFlag(c *gc.C) {
}

func (s *StoreSuite) TestInfoDNSError(c *gc.C) {
store := charm.NewStore("http://0.1.2.3")
store := charm.NewStore("http://127.1.2.3")
charmURL := charm.MustParseURL("cs:series/good")
resp, err := store.Info(charmURL)
c.Assert(resp, gc.IsNil)
Expand Down Expand Up @@ -377,15 +374,15 @@ func (s *StoreSuite) TestCharmURL(c *gc.C) {
}

type LocalRepoSuite struct {
testbase.LoggingSuite
testing.BaseSuite
repo *charm.LocalRepository
seriesPath string
}

var _ = gc.Suite(&LocalRepoSuite{})

func (s *LocalRepoSuite) SetUpTest(c *gc.C) {
s.LoggingSuite.SetUpTest(c)
s.BaseSuite.SetUpTest(c)
root := c.MkDir()
s.repo = &charm.LocalRepository{Path: root}
s.seriesPath = filepath.Join(root, "quantal")
Expand Down
4 changes: 2 additions & 2 deletions cloudinit/cloudinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
gc "launchpad.net/gocheck"

"launchpad.net/juju-core/cloudinit"
"launchpad.net/juju-core/testing/testbase"
coretesting "launchpad.net/juju-core/testing"
sshtesting "launchpad.net/juju-core/utils/ssh/testing"
)

// TODO integration tests, but how?

type S struct {
testbase.LoggingSuite
coretesting.BaseSuite
}

var _ = gc.Suite(S{})
Expand Down
3 changes: 1 addition & 2 deletions cloudinit/sshinit/configure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ import (
envtools "launchpad.net/juju-core/environs/tools"
"launchpad.net/juju-core/state/api/params"
coretesting "launchpad.net/juju-core/testing"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/tools"
"launchpad.net/juju-core/version"
)

type configureSuite struct {
testbase.LoggingSuite
coretesting.BaseSuite
}

var _ = gc.Suite(&configureSuite{})
Expand Down
7 changes: 3 additions & 4 deletions cmd/charm-admin/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import (

"launchpad.net/juju-core/cmd"
"launchpad.net/juju-core/testing"
"launchpad.net/juju-core/testing/testbase"
)

type ConfigSuite struct {
testbase.LoggingSuite
testing.BaseSuite
}

var _ = gc.Suite(&ConfigSuite{})
Expand All @@ -28,11 +27,11 @@ bar: false
`

func (s *ConfigSuite) SetUpSuite(c *gc.C) {
s.LoggingSuite.SetUpSuite(c)
s.BaseSuite.SetUpSuite(c)
}

func (s *ConfigSuite) TearDownSuite(c *gc.C) {
s.LoggingSuite.TearDownSuite(c)
s.BaseSuite.TearDownSuite(c)
}

type SomeConfigCommand struct {
Expand Down
Loading

0 comments on commit f8bcd3f

Please sign in to comment.