当前位置: 首页>>代码示例>>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;未经允许,请勿转载。