func (s *localServerSuite) SetUpSuite(c *gc.C) { s.LoggingSuite.SetUpSuite(c) s.Tests.SetUpSuite(c) restoreFinishBootstrap := envtesting.DisableFinishBootstrap() s.AddSuiteCleanup(func(*gc.C) { restoreFinishBootstrap() }) c.Logf("Running local tests") }
func (s *providerSuite) SetUpSuite(c *gc.C) { s.restoreTimeouts = envtesting.PatchAttemptStrategies(&shortAttempt) s.LoggingSuite.SetUpSuite(c) TestMAASObject := gomaasapi.NewTestMAAS("1.0") s.testMAASObject = TestMAASObject restoreFinishBootstrap := envtesting.DisableFinishBootstrap() s.AddSuiteCleanup(func(*gc.C) { restoreFinishBootstrap() }) }
func (s *localLiveSuite) SetUpSuite(c *gc.C) { s.LoggingSuite.SetUpSuite(c) c.Logf("Running live tests using openstack service test double") s.srv.start(c, s.cred) s.LiveTests.SetUpSuite(c) openstack.UseTestImageData(openstack.ImageMetadataStorage(s.Env), s.cred) restoreFinishBootstrap := envtesting.DisableFinishBootstrap() s.AddSuiteCleanup(func(*gc.C) { restoreFinishBootstrap() }) }
func patchEC2ForTesting() func() { ec2.UseTestImageData(ec2.TestImagesData) ec2.UseTestInstanceTypeData(ec2.TestInstanceTypeCosts) ec2.UseTestRegionData(ec2.TestRegions) restoreTimeouts := envtesting.PatchAttemptStrategies(ec2.ShortAttempt, ec2.StorageAttempt) restoreFinishBootstrap := envtesting.DisableFinishBootstrap() return func() { restoreFinishBootstrap() restoreTimeouts() ec2.UseTestImageData(nil) ec2.UseTestInstanceTypeData(nil) ec2.UseTestRegionData(nil) } }
func (s *localHTTPSServerSuite) TestCanBootstrap(c *gc.C) { restoreFinishBootstrap := envtesting.DisableFinishBootstrap() defer restoreFinishBootstrap() // For testing, we create a storage instance to which is uploaded tools and image metadata. metadataStorage := openstack.MetadataStorage(s.env) url, err := metadataStorage.URL("") c.Assert(err, gc.IsNil) c.Logf("Generating fake tools for: %v", url) envtesting.UploadFakeTools(c, metadataStorage) defer envtesting.RemoveFakeTools(c, metadataStorage) openstack.UseTestImageData(metadataStorage, s.cred) defer openstack.RemoveTestImageData(metadataStorage) err = bootstrap.Bootstrap(coretesting.Context(c), s.env, environs.BootstrapParams{}) c.Assert(err, gc.IsNil) }
func (s *localLiveSuite) SetUpSuite(c *gc.C) { s.LoggingSuite.SetUpSuite(c) s.AddSuiteCleanup(CreateTestKey(c)) s.cSrv = &localCloudAPIServer{} s.mSrv = &localMantaServer{} s.cSrv.setupServer(c) s.mSrv.setupServer(c) s.TestConfig = GetFakeConfig(s.cSrv.Server.URL, s.mSrv.Server.URL) s.TestConfig = s.TestConfig.Merge(coretesting.Attrs{ "image-metadata-url": "test://host", }) s.LiveTests.SetUpSuite(c) creds := joyent.MakeCredentials(c, s.TestConfig) joyent.UseExternalTestImageMetadata(creds) restoreFinishBootstrap := envtesting.DisableFinishBootstrap() s.AddSuiteCleanup(func(*gc.C) { restoreFinishBootstrap() }) }
func (s *BootstrapSuite) TestSuccess(c *gc.C) { stor := newStorage(s, c) checkInstanceId := "i-success" checkHardware := instance.MustParseHardware("mem=2T") startInstance := func( _ string, _ constraints.Value, _, _ []string, _ tools.List, mcfg *cloudinit.MachineConfig, ) ( instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, ) { return &mockInstance{id: checkInstanceId}, &checkHardware, nil, nil } var mocksConfig = minimalConfig(c) var getConfigCalled int getConfig := func() *config.Config { getConfigCalled++ return mocksConfig } setConfig := func(c *config.Config) error { mocksConfig = c return nil } restore := envtesting.DisableFinishBootstrap() defer restore() env := &mockEnviron{ storage: stor, startInstance: startInstance, config: getConfig, setConfig: setConfig, } originalAuthKeys := env.Config().AuthorizedKeys() ctx := coretesting.Context(c) err := common.Bootstrap(ctx, env, environs.BootstrapParams{}) c.Assert(err, gc.IsNil) authKeys := env.Config().AuthorizedKeys() c.Assert(authKeys, gc.Not(gc.Equals), originalAuthKeys) c.Assert(authKeys, jc.HasSuffix, "juju-system-key\n") }
func (s *localServerSuite) SetUpSuite(c *gc.C) { s.Tests.SetUpSuite(c) restoreFinishBootstrap := envtesting.DisableFinishBootstrap() s.AddSuiteCleanup(func(*gc.C) { restoreFinishBootstrap() }) }