~rogpeppe/juju-core/141-test-HOME-independence

« back to all changes in this revision

Viewing changes to environs/ec2/local_test.go

  • Committer: Roger Peppe
  • Date: 2012-11-13 13:43:04 UTC
  • Revision ID: roger.peppe@canonical.com-20121113134304-1z27u2bs22syxkkv
use FakeRootSuite where appropriate

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
                "admin-secret":   "local-secret",
34
34
                "access-key":     "x",
35
35
                "secret-key":     "x",
36
 
                "authorized-keys": "foo",
37
36
        }
38
37
 
39
38
        Suite(&localServerSuite{
53
52
// localLiveSuite runs tests from LiveTests using a fake
54
53
// EC2 server that runs within the test process itself.
55
54
type localLiveSuite struct {
56
 
        testing.LoggingSuite
 
55
        testing.FakeRootSuite
57
56
        LiveTests
58
57
        srv localServer
59
58
        env environs.Environ
60
59
}
61
60
 
62
61
func (t *localLiveSuite) SetUpSuite(c *C) {
63
 
        t.LoggingSuite.SetUpSuite(c)
 
62
        t.FakeRootSuite.SetUpSuite(c)
 
63
        t.FakeRootSuite.SetUpTest(c) // Use a fake root for the entire suite of tests.
64
64
        ec2.UseTestImageData(true)
65
65
        t.srv.startServer(c)
66
66
        t.LiveTests.SetUpSuite(c)
74
74
        t.env = nil
75
75
        ec2.ShortTimeouts(false)
76
76
        ec2.UseTestImageData(false)
77
 
        t.LoggingSuite.TearDownSuite(c)
 
77
        t.FakeRootSuite.TearDownTest(c) // Use a fake root for the entire suite of tests.
 
78
        t.FakeRootSuite.TearDownSuite(c)
78
79
}
79
80
 
80
81
func (t *localLiveSuite) SetUpTest(c *C) {
81
 
        t.LoggingSuite.SetUpTest(c)
82
82
        t.LiveTests.SetUpTest(c)
83
83
}
84
84
 
85
85
func (t *localLiveSuite) TearDownTest(c *C) {
86
86
        t.LiveTests.TearDownTest(c)
87
 
        t.LoggingSuite.TearDownTest(c)
88
87
}
89
88
 
90
89
// localServer represents a fake EC2 server running within
155
154
// accessed by using the "test" region, which is changed to point to the
156
155
// network address of the local server.
157
156
type localServerSuite struct {
158
 
        testing.LoggingSuite
 
157
        testing.FakeRootSuite
159
158
        jujutest.Tests
160
159
        srv localServer
161
160
        env environs.Environ
162
161
}
163
162
 
164
163
func (t *localServerSuite) SetUpSuite(c *C) {
165
 
        t.LoggingSuite.SetUpSuite(c)
 
164
        t.FakeRootSuite.SetUpSuite(c)
166
165
        ec2.UseTestImageData(true)
167
166
        ec2.UseTestMetadata(true)
168
167
        t.Tests.SetUpSuite(c)
174
173
        ec2.ShortTimeouts(false)
175
174
        ec2.UseTestMetadata(false)
176
175
        ec2.UseTestImageData(false)
177
 
        t.LoggingSuite.TearDownSuite(c)
 
176
        t.FakeRootSuite.TearDownSuite(c)
178
177
}
179
178
 
180
179
func (t *localServerSuite) SetUpTest(c *C) {
181
 
        t.LoggingSuite.SetUpTest(c)
 
180
        t.FakeRootSuite.SetUpTest(c)
182
181
        t.srv.startServer(c)
183
182
        t.Tests.SetUpTest(c)
184
183
        t.env = t.Tests.Env
187
186
func (t *localServerSuite) TearDownTest(c *C) {
188
187
        t.Tests.TearDownTest(c)
189
188
        t.srv.stopServer(c)
190
 
        t.LoggingSuite.TearDownTest(c)
 
189
        t.FakeRootSuite.TearDownTest(c)
191
190
}
192
191
 
193
192
func (t *localServerSuite) TestBootstrapInstanceUserDataAndState(c *C) {