當前位置: 首頁>>代碼示例>>Golang>>正文


Golang testing.PatchAttemptStrategies函數代碼示例

本文整理匯總了Golang中github.com/juju/juju/environs/testing.PatchAttemptStrategies函數的典型用法代碼示例。如果您正苦於以下問題:Golang PatchAttemptStrategies函數的具體用法?Golang PatchAttemptStrategies怎麽用?Golang PatchAttemptStrategies使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了PatchAttemptStrategies函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: start

func (s *localServer) start(c *gc.C, cred *identity.Credentials) {
	// Set up the HTTP server.
	if s.UseTLS {
		s.Server = httptest.NewTLSServer(nil)
	} else {
		s.Server = httptest.NewServer(nil)
	}
	c.Assert(s.Server, gc.NotNil)
	s.oldHandler = s.Server.Config.Handler
	s.Mux = http.NewServeMux()
	s.Server.Config.Handler = s.Mux
	cred.URL = s.Server.URL
	c.Logf("Started service at: %v", s.Server.URL)
	s.Service = openstackservice.New(cred, identity.AuthUserPass)
	s.Service.SetupHTTP(s.Mux)
	s.restoreTimeouts = envtesting.PatchAttemptStrategies(openstack.ShortAttempt, openstack.StorageAttempt)
	s.Service.Nova.SetAvailabilityZones(
		nova.AvailabilityZone{Name: "test-unavailable"},
		nova.AvailabilityZone{
			Name: "test-available",
			State: nova.AvailabilityZoneState{
				Available: true,
			},
		},
	)
}
開發者ID:klyachin,項目名稱:juju,代碼行數:26,代碼來源:local_test.go

示例2: 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

示例3: 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

示例4: 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

示例5: SetUpSuite

func (s *localLiveSuite) SetUpSuite(c *gc.C) {
	s.providerSuite.SetUpSuite(c)
	s.LiveTests.SetUpSuite(c)
	s.cSrv.setupServer(c)
	s.AddCleanup(s.cSrv.destroyServer)

	s.TestConfig = GetFakeConfig(s.cSrv.Server.URL)
	s.TestConfig = s.TestConfig.Merge(coretesting.Attrs{
		"image-metadata-url": "test://host",
	})
	s.LiveTests.UploadArches = []string{arch.AMD64}
	s.AddCleanup(func(*gc.C) { envtesting.PatchAttemptStrategies(&joyent.ShortAttempt) })
}
開發者ID:makyo,項目名稱:juju,代碼行數:13,代碼來源:local_test.go

示例6: 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

示例7: 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

示例8: SetUpSuite

func (s *localLiveSuite) SetUpSuite(c *gc.C) {
	s.baseSuite.SetUpSuite(c)
	s.LiveTests.SetUpSuite(c)
	s.cSrv.setupServer(c)
	s.AddCleanup(s.cSrv.destroyServer)

	s.Credential = cloud.NewCredential(cloud.UserPassAuthType, map[string]string{
		"sdc-user":    testUser,
		"sdc-key-id":  testKeyFingerprint,
		"private-key": testPrivateKey,
		"algorithm":   "rsa-sha256",
	})
	s.CloudEndpoint = s.cSrv.Server.URL
	s.CloudRegion = "some-region"

	s.TestConfig = GetFakeConfig().Merge(coretesting.Attrs{
		"image-metadata-url": "test://host",
	})
	s.PatchValue(&arch.HostArch, func() string { return arch.AMD64 })
	s.AddCleanup(func(*gc.C) { envtesting.PatchAttemptStrategies(&joyent.ShortAttempt) })
}
開發者ID:bac,項目名稱:juju,代碼行數:21,代碼來源:local_test.go

示例9: SetUpTest

func (s *ProviderSuite) SetUpTest(c *gc.C) {
	s.restoreTimeouts = envtesting.PatchAttemptStrategies(openstack.ShortAttempt, openstack.StorageAttempt)
}
開發者ID:klyachin,項目名稱:juju,代碼行數:3,代碼來源:local_test.go

示例10: SetUpSuite

// TDOO: jam 2013-12-06 This is copied from the providerSuite which is in a
// whitebox package maas. Either move that into a whitebox test so it can be
// shared, or into a 'testing' package so we can use it here.
func (s *environSuite) SetUpSuite(c *gc.C) {
	s.restoreTimeouts = envtesting.PatchAttemptStrategies(maas.ShortAttempt)
	s.BaseSuite.SetUpSuite(c)
	TestMAASObject := gomaasapi.NewTestMAAS("1.0")
	s.testMAASObject = TestMAASObject
}
開發者ID:exekias,項目名稱:juju,代碼行數:9,代碼來源:environ_test.go

示例11: SetUpSuite

func (s *EndpointSuite) SetUpSuite(c *gc.C) {
	// Use very short attempt strategies when getting instance addresses.
	s.restoreTimeouts = envtesting.PatchAttemptStrategies()
	s.JujuConnSuite.SetUpSuite(c)
}
開發者ID:exekias,項目名稱:juju,代碼行數:5,代碼來源:endpoint_test.go

示例12: SetUpSuite

func (s *providerSuite) SetUpSuite(c *gc.C) {
	s.restoreTimeouts = envtesting.PatchAttemptStrategies()
	s.FakeJujuHomeSuite.SetUpSuite(c)
}
開發者ID:Pankov404,項目名稱:juju,代碼行數:4,代碼來源:joyent_test.go

示例13: SetUpSuite

func (s *providerSuite) SetUpSuite(c *gc.C) {
	s.BaseSuite.SetUpSuite(c)
	s.restoreTimeouts = envtesting.PatchAttemptStrategies()
	s.UploadArches = []string{arch.AMD64}
}
開發者ID:Pankov404,項目名稱:juju,代碼行數:5,代碼來源:azure_test.go

示例14: SetUpSuite

func (s *baseSuite) SetUpSuite(c *gc.C) {
	s.FakeJujuXDGDataHomeSuite.SetUpSuite(c)
	s.restoreTimeouts = envtesting.PatchAttemptStrategies()
}
開發者ID:bac,項目名稱:juju,代碼行數:4,代碼來源:joyent_test.go

示例15: SetUpSuite

// TDOO: jam 2013-12-06 This is copied from the providerSuite which is in a
// whitebox package maas. Either move that into a whitebox test so it can be
// shared, or into a 'testing' package so we can use it here.
func (s *environSuite) SetUpSuite(c *gc.C) {
	s.restoreTimeouts = envtesting.PatchAttemptStrategies(maas.ShortAttempt)
	s.BaseSuite.SetUpSuite(c)
}
開發者ID:bac,項目名稱:juju,代碼行數:7,代碼來源:environ_test.go


注:本文中的github.com/juju/juju/environs/testing.PatchAttemptStrategies函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。