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


Golang fake_cake.FakeCake類代碼示例

本文整理匯總了Golang中code/cloudfoundry/org/garden-shed/layercake/fake_cake.FakeCake的典型用法代碼示例。如果您正苦於以下問題:Golang FakeCake類的具體用法?Golang FakeCake怎麽用?Golang FakeCake使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1:

		AfterEach(func() {
			Expect(os.RemoveAll(symlinkPath)).To(Succeed())
		})

		It("returns a ID of the symlinked directory", func() {
			pathID := idp.ProvideID(path1)
			symlinkID := idp.ProvideID(symlinkPath)
			Expect(symlinkID).To(Equal(pathID))
		})
	})
})

var _ = Describe("Local", func() {
	var (
		fetcher           *repository_fetcher.Local
		fakeCake          *fake_cake.FakeCake
		defaultRootFSPath string
		idProvider        UnderscoreIDer
	)

	BeforeEach(func() {
		fakeCake = new(fake_cake.FakeCake)
		defaultRootFSPath = ""
		idProvider = UnderscoreIDer{}

		// default to not containing an image
		fakeCake.GetReturns(nil, errors.New("no image"))
	})

	JustBeforeEach(func() {
		fetcher = &repository_fetcher.Local{
			Cake:              fakeCake,
開發者ID:cloudfoundry,項目名稱:garden-shed,代碼行數:32,代碼來源:local_test.go

示例2:

	"code.cloudfoundry.org/garden-shed/repository_fetcher"
	"code.cloudfoundry.org/garden-shed/rootfs_provider"
	fakes "code.cloudfoundry.org/garden-shed/rootfs_provider/rootfs_providerfakes"
	"code.cloudfoundry.org/lager"
	"code.cloudfoundry.org/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("The Cake Co-ordinator", func() {
	var (
		fakeFetcher      *fakes.FakeRepositoryFetcher
		fakeLayerCreator *fakes.FakeLayerCreator
		fakeCake         *fake_cake.FakeCake
		fakeGCer         *fakes.FakeGCer
		fakeMetrics      *fakes.FakeMetricser
		logger           *lagertest.TestLogger

		cakeOrdinator *rootfs_provider.CakeOrdinator
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")

		fakeFetcher = new(fakes.FakeRepositoryFetcher)

		fakeLayerCreator = new(fakes.FakeLayerCreator)
		fakeCake = new(fake_cake.FakeCake)
		fakeGCer = new(fakes.FakeGCer)
		fakeMetrics = new(fakes.FakeMetricser)
		cakeOrdinator = rootfs_provider.NewCakeOrdinator(fakeCake, fakeFetcher, fakeLayerCreator, fakeMetrics, fakeGCer)
開發者ID:cloudfoundry,項目名稱:garden-shed,代碼行數:32,代碼來源:cakeordinator_test.go

示例3:

	"code.cloudfoundry.org/garden-shed/layercake/cleaner"
	fakes "code.cloudfoundry.org/garden-shed/layercake/cleaner/cleanerfakes"
	"code.cloudfoundry.org/garden-shed/layercake/fake_cake"
	"code.cloudfoundry.org/lager"
	"code.cloudfoundry.org/lager/lagertest"
	"github.com/docker/docker/image"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Oven cleaner", func() {
	var (
		retainer      cleaner.RetainChecker
		gc            *cleaner.OvenCleaner
		fakeCake      *fake_cake.FakeCake
		child2parent  map[layercake.ID]layercake.ID // child -> parent
		size          map[layercake.ID]int64
		fakeThreshold *fakes.FakeThreshold
		logger        lager.Logger
	)

	BeforeEach(func() {
		fakeThreshold = new(fakes.FakeThreshold)
		logger = lagertest.NewTestLogger("test")

		retainer = cleaner.NewRetainer()

		fakeCake = new(fake_cake.FakeCake)
		fakeCake.GetStub = func(id layercake.ID) (*image.Image, error) {
			if parent, ok := child2parent[id]; ok {
				return &image.Image{
開發者ID:cloudfoundry,項目名稱:garden-shed,代碼行數:31,代碼來源:cleaner_test.go

示例4:

package cleaner_test

import (
	"code.cloudfoundry.org/garden-shed/layercake/cleaner"
	"code.cloudfoundry.org/garden-shed/layercake/fake_cake"
	"code.cloudfoundry.org/lager"
	"code.cloudfoundry.org/lager/lagertest"
	"github.com/docker/docker/image"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Threshold", func() {
	var (
		fakeCake  *fake_cake.FakeCake
		logger    lager.Logger
		threshold int64
	)

	BeforeEach(func() {
		threshold = 1234
		fakeCake = new(fake_cake.FakeCake)
		logger = lagertest.NewTestLogger("test")
	})

	Context("when there are no layers in the graph", func() {
		It("is not exceeded", func() {
			threshold := cleaner.NewThreshold(threshold)
			Expect(threshold.Exceeded(logger, fakeCake)).To(BeFalse())
		})
	})
開發者ID:cloudfoundry,項目名稱:garden-shed,代碼行數:31,代碼來源:threshold_test.go

示例5:

	"code.cloudfoundry.org/garden-shed/layercake"
	"code.cloudfoundry.org/garden-shed/layercake/fake_cake"
	"code.cloudfoundry.org/garden-shed/quota_manager"
	"code.cloudfoundry.org/lager"
	"code.cloudfoundry.org/lager/lagertest"
	"github.com/docker/docker/image"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("AUFSBaseSizer", func() {
	Describe("BaseSize", func() {
		var (
			baseSizer *quota_manager.AUFSBaseSizer
			fakeCake  *fake_cake.FakeCake

			logger lager.Logger
		)

		BeforeEach(func() {
			logger = lagertest.NewTestLogger("test")
			fakeCake = new(fake_cake.FakeCake)
			fakeCake.GetReturns(nil, errors.New("no such image"))

			baseSizer = quota_manager.NewAUFSBaseSizer(fakeCake)
		})

		It("asks for the size of the layer based on the base name of the rootfs path", func() {
			baseSizer.BaseSize(logger, "/some/path/to/54321")
			Expect(fakeCake.GetCallCount()).To(Equal(1))
			Expect(fakeCake.GetArgsForCall(0)).To(Equal(layercake.DockerImageID("54321")))
開發者ID:cloudfoundry,項目名稱:garden-shed,代碼行數:32,代碼來源:aufs_base_sizer_test.go

示例6: Create

type RootAndVolume struct {
	RootPath string
	Volume   string
}

func (f *FakeVolumeCreator) Create(path, v string) error {
	f.Created = append(f.Created, RootAndVolume{path, v})
	return f.CreateError
}

var _ = Describe("Layer Creator", func() {
	var (
		fakeCake          *fake_cake.FakeCake
		fakeNamespacer    *fake_namespacer.FakeNamespacer
		fakeVolumeCreator *FakeVolumeCreator
		name              string

		provider *rootfs_provider.ContainerLayerCreator
	)

	BeforeEach(func() {
		fakeCake = new(fake_cake.FakeCake)
		fakeVolumeCreator = &FakeVolumeCreator{}
		fakeNamespacer = &fake_namespacer.FakeNamespacer{}
		name = "some-name"

		provider = rootfs_provider.NewLayerCreator(
			fakeCake,
			fakeVolumeCreator,
			fakeNamespacer,
		)
開發者ID:cloudfoundry,項目名稱:garden-shed,代碼行數:31,代碼來源:layer_creator_test.go

示例7:

	"code.cloudfoundry.org/garden-shed/layercake/fake_id"
	"github.com/cloudfoundry/gunk/command_runner"
	"github.com/cloudfoundry/gunk/command_runner/fake_command_runner"
	"github.com/cloudfoundry/gunk/command_runner/linux_command_runner"
	"github.com/docker/docker/image"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Aufs", func() {
	var (
		aufsCake               *layercake.AufsCake
		cake                   *fake_cake.FakeCake
		parentID               *fake_id.FakeID
		childID                *fake_id.FakeID
		testError              error
		namespacedChildID      layercake.ID
		otherNamespacedChildID layercake.ID
		runner                 command_runner.CommandRunner
		baseDirectory          string
	)

	BeforeEach(func() {
		var err error
		baseDirectory, err = ioutil.TempDir("", "aufsTestGraphRoot")
		Expect(err).NotTo(HaveOccurred())

		cake = new(fake_cake.FakeCake)
		runner = linux_command_runner.New()

		parentID = new(fake_id.FakeID)
開發者ID:cloudfoundry,項目名稱:garden-shed,代碼行數:31,代碼來源:aufs_test.go

示例8:

	fakes "code.cloudfoundry.org/garden-shed/repository_fetcher/repository_fetcherfakes"
	"code.cloudfoundry.org/lager"
	"code.cloudfoundry.org/lager/lagertest"
	"github.com/docker/distribution/digest"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Fetching from a Remote repo", func() {
	var (
		fakeDialer   *fakes.FakeDialer
		fakeConn     *fake_distclient.FakeConn
		fakeCake     *fake_cake.FakeCake
		fakeVerifier *fakes.FakeVerifier

		remote *repository_fetcher.Remote

		manifests                 map[string]*distclient.Manifest
		blobs                     map[digest.Digest]string
		existingLayers            map[string]bool
		defaultDockerRegistryHost string
	)

	BeforeEach(func() {
		defaultDockerRegistryHost = "registry-1.docker.io"
	})

	JustBeforeEach(func() {
		existingLayers = map[string]bool{}

		manifests = map[string]*distclient.Manifest{
開發者ID:cloudfoundry,項目名稱:garden-shed,代碼行數:31,代碼來源:remote_test.go


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