本文整理汇总了Golang中github.com/juju/juju/environs/testing.DisableFinishBootstrap函数的典型用法代码示例。如果您正苦于以下问题:Golang DisableFinishBootstrap函数的具体用法?Golang DisableFinishBootstrap怎么用?Golang DisableFinishBootstrap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DisableFinishBootstrap函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestBootstrap
func (s *environSuite) TestBootstrap(c *gc.C) {
defer envtesting.DisableFinishBootstrap()()
ctx := envtesting.BootstrapContext(c)
env := prepareForBootstrap(c, ctx, s.provider, &s.sender)
s.sender = s.initResourceGroupSenders()
s.sender = append(s.sender, s.startInstanceSenders(true)...)
s.requests = nil
result, err := env.Bootstrap(
ctx, environs.BootstrapParams{
ControllerConfig: testing.FakeControllerConfig(),
AvailableTools: makeToolsList("quantal"),
BootstrapSeries: "quantal",
},
)
c.Assert(err, jc.ErrorIsNil)
c.Assert(result.Arch, gc.Equals, "amd64")
c.Assert(result.Series, gc.Equals, "quantal")
c.Assert(len(s.requests), gc.Equals, numExpectedStartInstanceRequests+1)
s.vmTags[tags.JujuIsController] = to.StringPtr("true")
s.assertStartInstanceRequests(c, s.requests[1:], assertStartInstanceRequestsParams{
availabilitySetName: "juju-controller",
imageReference: &quantalImageReference,
diskSizeGB: 32,
osProfile: &linuxOsProfile,
})
}
开发者ID:bac,项目名称:juju,代码行数:29,代码来源:environ_test.go
示例2: SetUpSuite
func (s *localServerSuite) SetUpSuite(c *gc.C) {
s.PatchValue(&imagemetadata.SimplestreamsImagesPublicKey, sstesting.SignedMetadataPublicKey)
s.PatchValue(&simplestreams.SimplestreamsJujuPublicKey, sstesting.SignedMetadataPublicKey)
s.providerSuite.SetUpSuite(c)
restoreFinishBootstrap := envtesting.DisableFinishBootstrap()
s.AddSuiteCleanup(func(*gc.C) { restoreFinishBootstrap() })
}
开发者ID:exekias,项目名称:juju,代码行数:8,代码来源:local_test.go
示例3: SetUpTest
func (s *localLiveSuite) SetUpTest(c *gc.C) {
s.providerSuite.SetUpTest(c)
creds := joyent.MakeCredentials(c, s.TestConfig)
joyent.UseExternalTestImageMetadata(creds)
restoreFinishBootstrap := envtesting.DisableFinishBootstrap()
s.AddCleanup(func(*gc.C) { restoreFinishBootstrap() })
s.LiveTests.SetUpTest(c)
}
开发者ID:kapilt,项目名称:juju,代码行数:8,代码来源:local_test.go
示例4: SetUpSuite
func (s *providerSuite) SetUpSuite(c *gc.C) {
s.restoreTimeouts = envtesting.PatchAttemptStrategies(&shortAttempt)
s.BaseSuite.SetUpSuite(c)
TestMAASObject := gomaasapi.NewTestMAAS("1.0")
s.testMAASObject = TestMAASObject
restoreFinishBootstrap := envtesting.DisableFinishBootstrap()
s.AddSuiteCleanup(func(*gc.C) { restoreFinishBootstrap() })
}
开发者ID:jiasir,项目名称:juju,代码行数:8,代码来源:maas_test.go
示例5: SetUpSuite
func (s *localLiveSuite) SetUpSuite(c *gc.C) {
s.BaseSuite.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() })
}
开发者ID:klyachin,项目名称:juju,代码行数:9,代码来源:local_test.go
示例6: SetUpSuite
func (s *baseProviderSuite) SetUpSuite(c *gc.C) {
s.FakeJujuXDGDataHomeSuite.SetUpSuite(c)
restoreTimeouts := envtesting.PatchAttemptStrategies(&shortAttempt)
restoreFinishBootstrap := envtesting.DisableFinishBootstrap()
s.AddCleanup(func(*gc.C) {
restoreFinishBootstrap()
restoreTimeouts()
})
}
开发者ID:bac,项目名称:juju,代码行数:9,代码来源:maas_test.go
示例7: SetUpTest
func (s *localLiveSuite) SetUpTest(c *gc.C) {
s.PatchValue(&version.Current, coretesting.FakeVersionNumber)
s.providerSuite.SetUpTest(c)
creds := joyent.MakeCredentials(c, s.TestConfig)
joyent.UseExternalTestImageMetadata(c, creds)
imagetesting.PatchOfficialDataSources(&s.CleanupSuite, "test://host")
restoreFinishBootstrap := envtesting.DisableFinishBootstrap()
s.AddCleanup(func(*gc.C) { restoreFinishBootstrap() })
s.LiveTests.SetUpTest(c)
}
开发者ID:exekias,项目名称:juju,代码行数:10,代码来源:local_test.go
示例8: SetUpSuite
func (s *baseProviderSuite) SetUpSuite(c *gc.C) {
s.FakeJujuXDGDataHomeSuite.SetUpSuite(c)
restoreTimeouts := envtesting.PatchAttemptStrategies(&shortAttempt)
restoreFinishBootstrap := envtesting.DisableFinishBootstrap()
s.AddCleanup(func(*gc.C) {
restoreFinishBootstrap()
restoreTimeouts()
})
s.PatchValue(&nodeDeploymentTimeout, func(*maasEnviron) time.Duration {
return coretesting.ShortWait
})
}
开发者ID:xushiwei,项目名称:juju,代码行数:12,代码来源:maas_test.go
示例9: patchEC2ForTesting
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)
}
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:14,代码来源:local_test.go
示例10: SetUpSuite
func (s *providerSuite) SetUpSuite(c *gc.C) {
s.FakeJujuHomeSuite.SetUpSuite(c)
restoreTimeouts := envtesting.PatchAttemptStrategies(&shortAttempt)
TestMAASObject := gomaasapi.NewTestMAAS("1.0")
s.testMAASObject = TestMAASObject
restoreFinishBootstrap := envtesting.DisableFinishBootstrap()
s.AddSuiteCleanup(func(*gc.C) {
restoreFinishBootstrap()
restoreTimeouts()
})
s.PatchValue(&nodeDeploymentTimeout, func(*maasEnviron) time.Duration {
return coretesting.ShortWait
})
}
开发者ID:ktsakalozos,项目名称:juju,代码行数:14,代码来源:maas_test.go
示例11: TestCanBootstrap
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)
}
开发者ID:klyachin,项目名称:juju,代码行数:17,代码来源:local_test.go
示例12: TestSuccess
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")
}
开发者ID:jiasir,项目名称:juju,代码行数:41,代码来源:bootstrap_test.go
示例13: SetUpSuite
func (s *localServerSuite) SetUpSuite(c *gc.C) {
s.providerSuite.SetUpSuite(c)
restoreFinishBootstrap := envtesting.DisableFinishBootstrap()
s.AddSuiteCleanup(func(*gc.C) { restoreFinishBootstrap() })
}
开发者ID:snailwalker,项目名称:juju,代码行数:5,代码来源:local_test.go
示例14: TestBootstrap
func (s *environSuite) TestBootstrap(c *gc.C) {
defer envtesting.DisableFinishBootstrap()()
ctx := envtesting.BootstrapContext(c)
env := prepareForBootstrap(c, ctx, s.provider, &s.sender)
s.sender = s.initResourceGroupSenders()
s.sender = append(s.sender, s.startInstanceSenders(true)...)
s.requests = nil
result, err := env.Bootstrap(
ctx, environs.BootstrapParams{
AvailableTools: makeToolsList("trusty"),
},
)
c.Assert(err, jc.ErrorIsNil)
c.Assert(result.Arch, gc.Equals, "amd64")
c.Assert(result.Series, gc.Equals, "trusty")
c.Assert(len(s.requests), gc.Equals, 17)
c.Assert(s.requests[0].Method, gc.Equals, "PUT") // resource group
c.Assert(s.requests[1].Method, gc.Equals, "PUT") // vnet
c.Assert(s.requests[2].Method, gc.Equals, "PUT") // network security group
c.Assert(s.requests[3].Method, gc.Equals, "PUT") // subnet
c.Assert(s.requests[4].Method, gc.Equals, "POST") // check storage account name
c.Assert(s.requests[5].Method, gc.Equals, "PUT") // create storage account
c.Assert(s.requests[6].Method, gc.Equals, "POST") // get storage account keys
emptyTags := map[string]*string{}
assertRequestBody(c, s.requests[0], &resources.Group{
Location: to.StringPtr("westus"),
Tags: &emptyTags,
})
s.vnet.ID = nil
s.vnet.Name = nil
assertRequestBody(c, s.requests[1], s.vnet)
securityRules := []network.SecurityRule{{
Name: to.StringPtr("SSHInbound"),
Properties: &network.SecurityRulePropertiesFormat{
Description: to.StringPtr("Allow SSH access to all machines"),
Protocol: network.SecurityRuleProtocolTCP,
SourceAddressPrefix: to.StringPtr("*"),
SourcePortRange: to.StringPtr("*"),
DestinationAddressPrefix: to.StringPtr("*"),
DestinationPortRange: to.StringPtr("22"),
Access: network.Allow,
Priority: to.IntPtr(100),
Direction: network.Inbound,
},
}}
assertRequestBody(c, s.requests[2], &network.SecurityGroup{
Location: to.StringPtr("westus"),
Tags: &emptyTags,
Properties: &network.SecurityGroupPropertiesFormat{
SecurityRules: &securityRules,
},
})
s.subnet.ID = nil
s.subnet.Name = nil
assertRequestBody(c, s.requests[3], s.subnet)
assertRequestBody(c, s.requests[4], &storage.AccountCheckNameAvailabilityParameters{
Name: to.StringPtr(fakeStorageAccount),
Type: to.StringPtr("Microsoft.Storage/storageAccounts"),
})
assertRequestBody(c, s.requests[5], &storage.AccountCreateParameters{
Location: to.StringPtr("westus"),
Tags: &emptyTags,
Properties: &storage.AccountPropertiesCreateParameters{
AccountType: "Standard_LRS",
},
})
}
开发者ID:makyo,项目名称:juju,代码行数:77,代码来源:environ_test.go
注:本文中的github.com/juju/juju/environs/testing.DisableFinishBootstrap函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论