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


Golang Config.SetS3BlobStore方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry-incubator/lattice/ltc/config.Config.SetS3BlobStore方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.SetS3BlobStore方法的具體用法?Golang Config.SetS3BlobStore怎麽用?Golang Config.SetS3BlobStore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry-incubator/lattice/ltc/config.Config的用法示例。


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

示例1:

			var config *config_package.Config

			BeforeEach(func() {
				config = config_package.New(nil)
				config.SetBlobStore("some-host", "some-port", "some-user", "some-password")
			})

			It("returns a new DavBlobStore Verifier", func() {
				verifier.Verify(config)
				Expect(fakeDAVVerifier.VerifyCallCount()).To(Equal(1))
				Expect(fakeS3Verifier.VerifyCallCount()).To(Equal(0))
			})
		})

		Context("when an s3 blob store is targeted", func() {
			var config *config_package.Config

			BeforeEach(func() {
				config = config_package.New(nil)
				config.SetS3BlobStore("", "", "some-bucket-name", "")
			})

			It("returns a new S3BlobStore Verifier", func() {
				verifier.Verify(config)
				Expect(fakeS3Verifier.VerifyCallCount()).To(Equal(1))
				Expect(fakeDAVVerifier.VerifyCallCount()).To(Equal(0))
			})
		})
	})
})
開發者ID:davidwadden,項目名稱:lattice-release,代碼行數:30,代碼來源:blob_store_test.go

示例2:

				Context("when no blob store username is set", func() {
					BeforeEach(func() {
						config.SetBlobStore("blobtarget.com", "8444", "", "")
						Expect(config.Save()).To(Succeed())
					})

					It("only prints the blob store host", func() {
						Expect(outputBuffer).To(test_helpers.SayLine("Droplet store:\tblobtarget.com:8444"))
					})
				})
			})

			Context("when a S3 blob store is targeted", func() {
				BeforeEach(func() {
					config.SetS3BlobStore("access", "secret", "bucket", "region")
					Expect(config.Save()).To(Succeed())
				})

				It("outputs the s3 bucket and region", func() {
					Expect(outputBuffer).To(test_helpers.SayLine("Droplet store:\ts3://bucket (region)"))
				})
			})
		})

		Context("when initially connecting to the receptor without authentication", func() {
			BeforeEach(func() {
				fakeTargetVerifier.VerifyTargetReturns(true, true, nil)
				fakeBlobStoreVerifier.VerifyReturns(true, nil)
			})
開發者ID:SrinivasChilveri,項目名稱:lattice,代碼行數:29,代碼來源:config_command_factory_test.go

示例3:

		It("returns errors from loading the config", func() {
			testPersister.err = errors.New("Error")

			err := testConfig.Load()
			Expect(err).To(MatchError("Error"))
		})
	})

	Describe("ActiveBlobStore", func() {
		It("defaults to 'dav'", func() {
			Expect(testConfig.ActiveBlobStore().String()).To(Equal("dav"))
		})

		It("reports the active blobstore", func() {
			testConfig.SetS3BlobStore("some-access-key", "some-secret-key", "some-bucket-name", "some-s3-region")
			Expect(testConfig.ActiveBlobStore().String()).To(Equal("s3"))
		})
	})

	Describe("TargetBlob", func() {
		It("sets the blob target", func() {
			testConfig.SetBlobStore("some-host", "7474", "some-username", "some-password")

			Expect(testConfig.BlobStore()).To(Equal(config.BlobStoreConfig{
				Host:     "some-host",
				Port:     "7474",
				Username: "some-username",
				Password: "some-password",
			}))
		})
開發者ID:davidwadden,項目名稱:lattice-release,代碼行數:30,代碼來源:config_test.go


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