当前位置: 首页>>代码示例>>Golang>>正文


Golang fakes.FakeBlobstore类代码示例

本文整理汇总了Golang中github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/blobstore/fakes.FakeBlobstore的典型用法代码示例。如果您正苦于以下问题:Golang FakeBlobstore类的具体用法?Golang FakeBlobstore怎么用?Golang FakeBlobstore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FakeBlobstore类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

	. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"

	boshblob "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/blobstore"
	fakeblob "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/blobstore/fakes"
	bosherr "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/errors"
)

var _ = Describe("sha1VerifiableBlobstore", func() {
	const (
		fixturePath = "test_assets/some.config"
		fixtureSHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709"
	)

	var (
		innerBlobstore          *fakeblob.FakeBlobstore
		sha1VerifiableBlobstore boshblob.Blobstore
	)

	BeforeEach(func() {
		innerBlobstore = &fakeblob.FakeBlobstore{}
		sha1VerifiableBlobstore = boshblob.NewSHA1VerifiableBlobstore(innerBlobstore)
	})

	Describe("Get", func() {
		It("returns without an error if sha1 matches", func() {
			innerBlobstore.GetFileName = fixturePath

			fileName, err := sha1VerifiableBlobstore.Get("fake-blob-id", fixtureSHA1)
			Expect(err).ToNot(HaveOccurred())

			Expect(innerBlobstore.GetBlobIDs).To(Equal([]string{"fake-blob-id"}))
开发者ID:vestel,项目名称:bosh-init,代码行数:32,代码来源:sha1_verifiable_blobstore_test.go

示例2:

import (
	"errors"

	. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"

	boshblob "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/blobstore"
	fakeblob "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/blobstore/fakes"
	bosherr "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/errors"
	boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
)

var _ = Describe("retryableBlobstore", func() {
	var (
		innerBlobstore     *fakeblob.FakeBlobstore
		logger             boshlog.Logger
		retryableBlobstore boshblob.Blobstore
	)

	BeforeEach(func() {
		innerBlobstore = &fakeblob.FakeBlobstore{}
		logger = boshlog.NewLogger(boshlog.LevelNone)
		retryableBlobstore = boshblob.NewRetryableBlobstore(innerBlobstore, 3, logger)
	})

	Describe("Get", func() {
		Context("when inner blobstore succeeds before maximum number of get tries (first time)", func() {
			It("returns path without an error", func() {
				innerBlobstore.GetFileName = "fake-path"

				path, err := retryableBlobstore.Get("fake-blob-id", "fake-fingerprint")
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:retryable_blobstore_test.go

示例3:

	fakeblobstore "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/blobstore/fakes"
	fakecmd "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/fileutil/fakes"
	boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
	fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
	. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
)

var _ = Describe("Extractor", func() {
	var (
		extractor  Extractor
		blobstore  *fakeblobstore.FakeBlobstore
		targetDir  string
		compressor *fakecmd.FakeCompressor
		logger     boshlog.Logger
		fs         *fakesys.FakeFileSystem

		blobID    string
		blobSHA1  string
		fileName  string
		fakeError error
	)

	BeforeEach(func() {
		blobstore = fakeblobstore.NewFakeBlobstore()
		targetDir = "fake-target-dir"
		compressor = fakecmd.NewFakeCompressor()
		logger = boshlog.NewLogger(boshlog.LevelNone)
		fs = fakesys.NewFakeFileSystem()
		blobID = "fake-blob-id"
		blobSHA1 = "fake-sha1"
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:extractor_test.go

示例4:

	BeforeEach(func() {
		mockCtrl = gomock.NewController(GinkgoT())
	})

	AfterEach(func() {
		mockCtrl.Finish()
	})

	var (
		logger                  boshlog.Logger
		compiler                bistatepkg.Compiler
		runner                  *fakesys.FakeCmdRunner
		pkg                     *birelpkg.Package
		fs                      *fakesys.FakeFileSystem
		compressor              *fakecmd.FakeCompressor
		packagesDir             string
		blobstore               *fakeblobstore.FakeBlobstore
		mockCompiledPackageRepo *mock_state_package.MockCompiledPackageRepo

		fakeExtractor *fakeblobextract.FakeExtractor

		dependency1 *birelpkg.Package
		dependency2 *birelpkg.Package
	)

	BeforeEach(func() {
		logger = boshlog.NewLogger(boshlog.LevelNone)
		packagesDir = "fake-packages-dir"
		runner = fakesys.NewFakeCmdRunner()
		fs = fakesys.NewFakeFileSystem()
		compressor = fakecmd.NewFakeCompressor()
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:compiler_test.go

示例5:

	AfterEach(func() {
		mockCtrl.Finish()
	})

	var (
		mockJobListRenderer *mock_template.MockJobListRenderer
		fakeCompressor      *fakeboshcmd.FakeCompressor
		fakeBlobstore       *fakeboshblob.FakeBlobstore

		fakeFS *fakeboshsys.FakeFileSystem

		logger boshlog.Logger

		renderer installation.JobRenderer

		releaseJob  bireljob.Job
		releaseJobs []bireljob.Job

		manifest  biinstallmanifest.Manifest
		fakeStage *fakebiui.FakeStage

		releasePackage1 *birelpkg.Package
		releasePackage2 *birelpkg.Package

		expectJobRender *gomock.Call

		renderedJobList bitemplate.RenderedJobList
	)

	BeforeEach(func() {
		mockJobListRenderer = mock_template.NewMockJobListRenderer(mockCtrl)
		fakeCompressor = fakeboshcmd.NewFakeCompressor()
开发者ID:vestel,项目名称:bosh-init,代码行数:32,代码来源:job_renderer_test.go


注:本文中的github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/blobstore/fakes.FakeBlobstore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。