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


Golang gomock.Call類代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/bosh-init/internal/github.com/golang/mock/gomock.Call的典型用法代碼示例。如果您正苦於以下問題:Golang Call類的具體用法?Golang Call怎麽用?Golang Call使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: describeBuilder

func describeBuilder() {
	var mockCtrl *gomock.Controller

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

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

	var (
		logger boshlog.Logger

		mockReleaseJobResolver *mock_deployment_release.MockJobResolver
		mockDependencyCompiler *mock_state_job.MockDependencyCompiler
		mockJobListRenderer    *mock_template.MockJobListRenderer
		mockCompressor         *mock_template.MockRenderedJobListCompressor
		mockBlobstore          *mock_blobstore.MockBlobstore

		stateBuilder Builder
	)

	BeforeEach(func() {
		logger = boshlog.NewLogger(boshlog.LevelNone)

		mockReleaseJobResolver = mock_deployment_release.NewMockJobResolver(mockCtrl)
		mockDependencyCompiler = mock_state_job.NewMockDependencyCompiler(mockCtrl)
		mockJobListRenderer = mock_template.NewMockJobListRenderer(mockCtrl)
		mockCompressor = mock_template.NewMockRenderedJobListCompressor(mockCtrl)
		mockBlobstore = mock_blobstore.NewMockBlobstore(mockCtrl)
	})

	Describe("Build", func() {
		var (
			mockRenderedJobList        *mock_template.MockRenderedJobList
			mockRenderedJobListArchive *mock_template.MockRenderedJobListArchive

			jobName            string
			instanceID         int
			deploymentManifest bideplmanifest.Manifest
			fakeStage          *fakebiui.FakeStage

			releasePackageLibyaml *birelpkg.Package
			releasePackageRuby    *birelpkg.Package
			releasePackageCPI     *birelpkg.Package

			expectCompile *gomock.Call
		)

		BeforeEach(func() {
			mockRenderedJobList = mock_template.NewMockRenderedJobList(mockCtrl)
			mockRenderedJobListArchive = mock_template.NewMockRenderedJobListArchive(mockCtrl)

			jobName = "fake-deployment-job-name"
			instanceID = 0

			deploymentManifest = bideplmanifest.Manifest{
				Name: "fake-deployment-name",
				Jobs: []bideplmanifest.Job{
					{
						Name: "fake-deployment-job-name",
						Networks: []bideplmanifest.JobNetwork{
							{
								Name: "fake-network-name",
							},
						},
						Templates: []bideplmanifest.ReleaseJobRef{
							{
								Name:    "fake-release-job-name",
								Release: "fake-release-name",
							},
						},
						Properties: biproperty.Map{
							"fake-job-property": "fake-job-property-value",
						},
					},
				},
				Networks: []bideplmanifest.Network{
					{
						Name: "fake-network-name",
						Type: "fake-network-type",
						CloudProperties: biproperty.Map{
							"fake-network-cloud-property": "fake-network-cloud-property-value",
						},
					},
				},
				Properties: biproperty.Map{
					"fake-job-property": "fake-global-property-value", //overridden by job property value
				},
			}

			fakeStage = fakebiui.NewFakeStage()

			stateBuilder = NewBuilder(
				mockReleaseJobResolver,
				mockDependencyCompiler,
				mockJobListRenderer,
				mockCompressor,
				mockBlobstore,
//.........這裏部分代碼省略.........
開發者ID:vestel,項目名稱:bosh-init,代碼行數:101,代碼來源:builder_test.go

示例2:

		var (
			fs                          *fakesys.FakeFileSystem
			logger                      boshlog.Logger
			releaseManager              birel.Manager
			mockCpiInstaller            *mock_install.MockInstaller
			mockCpiUninstaller          *mock_install.MockUninstaller
			mockInstallerFactory        *mock_install.MockInstallerFactory
			mockCloudFactory            *mock_cloud.MockFactory
			mockReleaseExtractor        *mock_release.MockExtractor
			fakeUUIDGenerator           *fakeuuid.FakeGenerator
			setupDeploymentStateService biconfig.DeploymentStateService
			fakeInstallation            *fakecmd.FakeInstallation

			fakeUI *fakeui.FakeUI

			mockBlobstoreFactory *mock_blobstore.MockFactory
			mockBlobstore        *mock_blobstore.MockBlobstore

			mockDeploymentManagerFactory *mock_deployment.MockManagerFactory
			mockDeploymentManager        *mock_deployment.MockManager
			mockDeployment               *mock_deployment.MockDeployment

			mockAgentClient        *mock_agentclient.MockAgentClient
			mockAgentClientFactory *mock_httpagent.MockAgentClientFactory
			mockCloud              *mock_cloud.MockCloud

			fakeStage *fakebiui.FakeStage

			directorID string

			deploymentManifestPath = "/deployment-dir/fake-deployment-manifest.yml"
			deploymentStatePath    string

			expectCPIExtractRelease *gomock.Call
			expectCPIInstall        *gomock.Call
			expectNewCloud          *gomock.Call

			mbusURL = "http://fake-mbus-user:[email protected]"
		)
開發者ID:hanzhefeng,項目名稱:bosh-init,代碼行數:39,代碼來源:deployment_deleteter_test.go

示例3:

			It("logs vm delete as skipped", func() {
				err := instance.Delete(pingTimeout, pingDelay, fakeStage)
				Expect(err).NotTo(HaveOccurred())

				Expect(fakeStage.PerformCalls[0].Name).To(Equal("Deleting VM 'fake-vm-cid'"))
				Expect(fakeStage.PerformCalls[0].SkipError.Error()).To(Equal("VM not found: CPI 'delete_vm' method responded with error: CmdError{\"type\":\"Bosh::Clouds::VMNotFound\",\"message\":\"fake-vm-not-found-message\",\"ok_to_retry\":false}"))
			})
		})
	})

	Describe("UpdateJobs", func() {
		var (
			deploymentManifest bideplmanifest.Manifest

			applySpec bias.ApplySpec

			expectStateBuild *gomock.Call
		)

		BeforeEach(func() {
			// manifest is only being used for the Update.UpdateWatchTime, otherwise it's just being passed through to the StateBuilder
			deploymentManifest = bideplmanifest.Manifest{
				Name: "fake-deployment-name",
				Update: bideplmanifest.Update{
					UpdateWatchTime: bideplmanifest.WatchTime{
						Start: 0,
						End:   5478,
					},
				},
			}
開發者ID:vestel,項目名稱:bosh-init,代碼行數:30,代碼來源:instance_test.go

示例4: describeRemotePackageCompiler

func describeRemotePackageCompiler() {
	var mockCtrl *gomock.Controller

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

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

	var (
		packageRepo bistatepkg.CompiledPackageRepo

		pkgDependency *birelpkg.Package
		pkg           *birelpkg.Package

		mockBlobstore   *mock_blobstore.MockBlobstore
		mockAgentClient *mock_agentclient.MockAgentClient

		archivePath = "fake-archive-path"

		remotePackageCompiler bistatepkg.Compiler

		compiledPackages map[bistatepkg.CompiledPackageRecord]*birelpkg.Package

		expectBlobstoreAdd *gomock.Call
		expectAgentCompile *gomock.Call
	)

	BeforeEach(func() {
		mockBlobstore = mock_blobstore.NewMockBlobstore(mockCtrl)
		mockAgentClient = mock_agentclient.NewMockAgentClient(mockCtrl)

		index := biindex.NewInMemoryIndex()
		packageRepo = bistatepkg.NewCompiledPackageRepo(index)
		remotePackageCompiler = NewRemotePackageCompiler(mockBlobstore, mockAgentClient, packageRepo)

		pkgDependency = &birelpkg.Package{
			Name:        "fake-package-name-dep",
			Fingerprint: "fake-package-fingerprint-dep",
		}

		pkg = &birelpkg.Package{
			Name:         "fake-package-name",
			Fingerprint:  "fake-package-fingerprint",
			SHA1:         "fake-source-package-sha1",
			ArchivePath:  archivePath,
			Dependencies: []*birelpkg.Package{pkgDependency},
		}

		depRecord1 := bistatepkg.CompiledPackageRecord{
			BlobID:   "fake-compiled-package-blob-id-dep",
			BlobSHA1: "fake-compiled-package-sha1-dep",
		}

		compiledPackages = map[bistatepkg.CompiledPackageRecord]*birelpkg.Package{
			depRecord1: pkgDependency,
		}
	})

	JustBeforeEach(func() {
		// add compiled packages to the repo
		for record, dependency := range compiledPackages {
			err := packageRepo.Save(*dependency, record)
			Expect(err).ToNot(HaveOccurred())
		}

		packageSource := biagentclient.BlobRef{
			Name:        "fake-package-name",
			Version:     "fake-package-fingerprint",
			BlobstoreID: "fake-source-package-blob-id",
			SHA1:        "fake-source-package-sha1",
		}
		packageDependencies := []biagentclient.BlobRef{
			{
				Name:        "fake-package-name-dep",
				Version:     "fake-package-fingerprint-dep",
				BlobstoreID: "fake-compiled-package-blob-id-dep",
				SHA1:        "fake-compiled-package-sha1-dep",
			},
		}
		compiledPackageRef := biagentclient.BlobRef{
			Name:        "fake-package-name",
			Version:     "fake-package-version",
			BlobstoreID: "fake-compiled-package-blob-id",
			SHA1:        "fake-compiled-package-sha1",
		}

		expectBlobstoreAdd = mockBlobstore.EXPECT().Add(archivePath).Return("fake-source-package-blob-id", nil).AnyTimes()
		expectAgentCompile = mockAgentClient.EXPECT().CompilePackage(packageSource, packageDependencies).Return(compiledPackageRef, nil).AnyTimes()
	})

	Describe("Compile", func() {
		It("uploads the package archive to the blobstore and then compiles the package with the agent", func() {
			gomock.InOrder(
				expectBlobstoreAdd.Times(1),
				expectAgentCompile.Times(1),
			)

//.........這裏部分代碼省略.........
開發者ID:hanzhefeng,項目名稱:bosh-init,代碼行數:101,代碼來源:remote_package_compiler_test.go

示例5:

		var (
			fs     *fakesys.FakeFileSystem
			logger boshlog.Logger

			registryServerManager biregistry.ServerManager
			releaseManager        birel.Manager

			mockInstaller          *mock_install.MockInstaller
			mockInstallerFactory   *mock_install.MockInstallerFactory
			mockCloudFactory       *mock_cloud.MockFactory
			mockCloud              *mock_cloud.MockCloud
			mockAgentClient        *mock_agentclient.MockAgentClient
			mockAgentClientFactory *mock_httpagent.MockAgentClientFactory
			mockReleaseExtractor   *mock_release.MockExtractor

			mockStateBuilderFactory *mock_instance_state.MockBuilderFactory
			mockStateBuilder        *mock_instance_state.MockBuilder
			mockState               *mock_instance_state.MockState

			mockBlobstoreFactory *mock_blobstore.MockFactory
			mockBlobstore        *mock_blobstore.MockBlobstore

			fakeStemcellExtractor         *fakebistemcell.FakeExtractor
			fakeUUIDGenerator             *fakeuuid.FakeGenerator
			fakeRegistryUUIDGenerator     *fakeuuid.FakeGenerator
			fakeRepoUUIDGenerator         *fakeuuid.FakeGenerator
			fakeAgentIDGenerator          *fakeuuid.FakeGenerator
			fakeSHA1Calculator            *fakebicrypto.FakeSha1Calculator
			legacyDeploymentStateMigrator biconfig.LegacyDeploymentStateMigrator
			deploymentStateService        biconfig.DeploymentStateService
			vmRepo                        biconfig.VMRepo
			diskRepo                      biconfig.DiskRepo
			stemcellRepo                  biconfig.StemcellRepo
			deploymentRepo                biconfig.DeploymentRepo
			releaseRepo                   biconfig.ReleaseRepo

			sshTunnelFactory bisshtunnel.Factory

			diskManagerFactory bidisk.ManagerFactory
			diskDeployer       bivm.DiskDeployer

			stdOut    *gbytes.Buffer
			stdErr    *gbytes.Buffer
			fakeStage *fakebiui.FakeStage

			stemcellManagerFactory bistemcell.ManagerFactory
			vmManagerFactory       bivm.ManagerFactory

			applySpec bias.ApplySpec

			directorID string

			stemcellTarballPath    = "/fake-stemcell-release.tgz"
			deploymentManifestPath = "/deployment-dir/fake-deployment-manifest.yml"
			deploymentStatePath    = "/deployment-dir/fake-deployment-manifest-state.json"

			stemcellImagePath       = "fake-stemcell-image-path"
			stemcellCID             = "fake-stemcell-cid"
			stemcellCloudProperties = biproperty.Map{}

			vmCloudProperties = biproperty.Map{}
			vmEnv             = biproperty.Map{}

			diskCloudProperties = biproperty.Map{}

			networkInterfaces = map[string]biproperty.Map{
				"network-1": biproperty.Map{
					"type":             "dynamic",
					"default":          []bideplmanifest.NetworkDefault{"dns", "gateway"},
					"cloud_properties": biproperty.Map{},
				},
			}

			agentRunningState = biagentclient.AgentState{JobState: "running"}
			mbusURL           = "http://fake-mbus-url"

			expectHasVM1    *gomock.Call
			expectDeleteVM1 *gomock.Call

			sshConfig *SSHConfig
		)
開發者ID:vestel,項目名稱:bosh-init,代碼行數:81,代碼來源:deploy_test.go

示例6:

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

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

	var (
		mockDependencyCompiler *mock_state_job.MockDependencyCompiler

		fakeFS   *fakeboshsys.FakeFileSystem
		compiler installation.PackageCompiler

		releaseJob  bireljob.Job
		releaseJobs []bireljob.Job

		fakeStage *fakebiui.FakeStage

		releasePackage1 *birelpkg.Package
		releasePackage2 *birelpkg.Package

		expectCompile *gomock.Call
	)

	BeforeEach(func() {
		mockDependencyCompiler = mock_state_job.NewMockDependencyCompiler(mockCtrl)

		fakeFS = fakeboshsys.NewFakeFileSystem()

		fakeStage = fakebiui.NewFakeStage()
開發者ID:vestel,項目名稱:bosh-init,代碼行數:31,代碼來源:package_compiler_test.go

示例7:

	BeforeEach(func() {
		manifest = biinstallmanifest.Manifest{}

		mockRegistryServerManager = mock_registry.NewMockServerManager(mockCtrl)
		mockRegistryServer = mock_registry.NewMockServer(mockCtrl)

		target = NewTarget("fake-installation-path")

		installedJob = NewInstalledJob(RenderedJobRef{Name: "cpi"}, "fake-job-path")
	})

	Describe("WithRunningRegistry", func() {
		var (
			startCall, spyCall, stopCall *gomock.Call
			spy                          *test_support_mocks.MockSpy
			logBuffer                    *gbytes.Buffer
			logger                       boshlog.Logger
			fakeStage                    *fakebiui.FakeStage
		)

		BeforeEach(func() {
			manifest.Registry = biinstallmanifest.Registry{
				Username: "fake-username",
				Password: "fake-password",
				Host:     "fake-host",
				Port:     123,
			}

			spy = test_support_mocks.NewMockSpy(mockCtrl)
			startCall = mockRegistryServerManager.EXPECT().Start("fake-username", "fake-password", "fake-host", 123).Return(mockRegistryServer, nil)
			spyCall = spy.EXPECT().Record()
開發者ID:vestel,項目名稱:bosh-init,代碼行數:31,代碼來源:installation_test.go

示例8:

		mockCtrl = gomock.NewController(GinkgoT())
	})

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

	Describe("FindCurrent", func() {
		var (
			mockInstanceManager   *mock_instance.MockManager
			mockDiskManager       *mock_disk.MockManager
			mockStemcellManager   *mock_stemcell.MockManager
			mockDeploymentFactory *mock_deployment.MockFactory
			mockDeployment        *mock_deployment.MockDeployment

			deploymentManager Manager

			expectedInstances []biinstance.Instance
			expectedDisks     []bidisk.Disk
			expectedStemcells []bistemcell.CloudStemcell

			expectNewDeployment *gomock.Call
		)

		BeforeEach(func() {
			mockInstanceManager = mock_instance.NewMockManager(mockCtrl)
			mockDiskManager = mock_disk.NewMockManager(mockCtrl)
			mockStemcellManager = mock_stemcell.NewMockManager(mockCtrl)
			mockDeploymentFactory = mock_deployment.NewMockFactory(mockCtrl)
			mockDeployment = mock_deployment.NewMockDeployment(mockCtrl)
開發者ID:vestel,項目名稱:bosh-init,代碼行數:30,代碼來源:manager_test.go

示例9:

		mockCtrl = gomock.NewController(GinkgoT())
	})

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

	var (
		logger boshlog.Logger

		mockJobRenderer *mock_template.MockJobRenderer

		releaseJobs      []bireljob.Job
		jobProperties    biproperty.Map
		globalProperties biproperty.Map
		deploymentName   string

		renderedJobs []*mock_template.MockRenderedJob

		jobListRenderer JobListRenderer

		//		expectRender0 *gomock.Call
		expectRender1 *gomock.Call
	)

	BeforeEach(func() {
		logger = boshlog.NewLogger(boshlog.LevelNone)
		mockJobRenderer = mock_template.NewMockJobRenderer(mockCtrl)

		// release jobs are just passed through to JobRenderer.Render, so they do not need real contents
		releaseJobs = []bireljob.Job{
開發者ID:vestel,項目名稱:bosh-init,代碼行數:31,代碼來源:job_list_renderer_test.go

示例10:

			logger,
		)

		pkg = &birelpkg.Package{
			Name:          "fake-package-1",
			ExtractedPath: "/fake/path",
			Dependencies:  []*birelpkg.Package{dependency1, dependency2},
		}
	})

	Describe("Compile", func() {
		var (
			compiledPackageTarballPath string
			installPath                string

			dep1 bistatepkg.CompiledPackageRecord
			dep2 bistatepkg.CompiledPackageRecord

			expectFind *gomock.Call
			expectSave *gomock.Call
		)

		BeforeEach(func() {
			installPath = path.Join(packagesDir, pkg.Name)
			compiledPackageTarballPath = path.Join(packagesDir, "new-tarball.tgz")
		})

		JustBeforeEach(func() {
			expectFind = mockCompiledPackageRepo.EXPECT().Find(*pkg).Return(bistatepkg.CompiledPackageRecord{}, false, nil).AnyTimes()

			dep1 = bistatepkg.CompiledPackageRecord{
				BlobID:   "fake-dependency-blobstore-id-1",
開發者ID:vestel,項目名稱:bosh-init,代碼行數:32,代碼來源:compiler_test.go

示例11:

	var mockCtrl *gomock.Controller

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

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

	var (
		mockReleaseJobResolver *mock_deployment_release.MockJobResolver

		resolver installation.JobResolver

		releaseJob bireljob.Job

		manifest biinstallmanifest.Manifest

		expectJobResolve *gomock.Call
	)

	BeforeEach(func() {
		mockReleaseJobResolver = mock_deployment_release.NewMockJobResolver(mockCtrl)

		manifest = biinstallmanifest.Manifest{
			Name: "fake-installation-name",
			Template: biinstallmanifest.ReleaseJobRef{
				Name:    "fake-cpi-job-name",
				Release: "fake-cpi-release-name",
			},
開發者ID:jmaryland,項目名稱:bosh-init,代碼行數:31,代碼來源:job_resolver_test.go

示例12: rootDesc

func rootDesc() {
	var mockCtrl *gomock.Controller

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

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

	Describe("Run", func() {
		var (
			command        bicmd.Cmd
			fakeFs         *fakesys.FakeFileSystem
			stdOut         *gbytes.Buffer
			stdErr         *gbytes.Buffer
			userInterface  biui.UI
			sha1Calculator crypto.SHA1Calculator
			manifestSHA1   string

			mockDeployer              *mock_deployment.MockDeployer
			mockInstaller             *mock_install.MockInstaller
			mockInstallerFactory      *mock_install.MockInstallerFactory
			mockReleaseExtractor      *mock_release.MockExtractor
			releaseManager            birel.Manager
			mockRegistryServerManager *mock_registry.MockServerManager
			mockRegistryServer        *mock_registry.MockServer
			mockAgentClient           *mock_agentclient.MockAgentClient
			mockAgentClientFactory    *mock_httpagent.MockAgentClientFactory
			mockCloudFactory          *mock_cloud.MockFactory

			fakeCPIRelease *fakebirel.FakeRelease
			logger         boshlog.Logger

			mockBlobstoreFactory *mock_blobstore.MockFactory
			mockBlobstore        *mock_blobstore.MockBlobstore

			mockVMManagerFactory       *mock_vm.MockManagerFactory
			fakeVMManager              *fakebivm.FakeManager
			fakeStemcellExtractor      *fakebistemcell.FakeExtractor
			mockStemcellManager        *mock_stemcell.MockManager
			fakeStemcellManagerFactory *fakebistemcell.FakeManagerFactory

			fakeReleaseSetParser              *fakebirelsetmanifest.FakeParser
			fakeInstallationParser            *fakebiinstallmanifest.FakeParser
			fakeDeploymentParser              *fakebideplmanifest.FakeParser
			mockLegacyDeploymentStateMigrator *mock_config.MockLegacyDeploymentStateMigrator
			setupDeploymentStateService       biconfig.DeploymentStateService
			fakeDeploymentValidator           *fakebideplval.FakeValidator

			directorID          = "generated-director-uuid"
			fakeUUIDGenerator   *fakeuuid.FakeGenerator
			configUUIDGenerator *fakeuuid.FakeGenerator

			fakeStage *fakebiui.FakeStage

			deploymentManifestPath string
			deploymentStatePath    string
			cpiReleaseTarballPath  string
			stemcellTarballPath    string
			extractedStemcell      bistemcell.ExtractedStemcell

			expectDeploy *gomock.Call

			mbusURL = "http://fake-mbus-user:[email protected]"

			releaseSetManifest     birelsetmanifest.Manifest
			boshDeploymentManifest bideplmanifest.Manifest
			installationManifest   biinstallmanifest.Manifest
			cloud                  bicloud.Cloud

			cloudStemcell bistemcell.CloudStemcell

			expectLegacyMigrate        *gomock.Call
			expectStemcellUpload       *gomock.Call
			expectStemcellDeleteUnused *gomock.Call
			expectCPIReleaseExtract    *gomock.Call
			expectInstall              *gomock.Call
			expectNewCloud             *gomock.Call
		)

		BeforeEach(func() {
			logger = boshlog.NewLogger(boshlog.LevelNone)
			stdOut = gbytes.NewBuffer()
			stdErr = gbytes.NewBuffer()
			userInterface = biui.NewWriterUI(stdOut, stdErr, logger)
			fakeFs = fakesys.NewFakeFileSystem()
			fakeFs.EnableStrictTempRootBehavior()
			deploymentManifestPath = "/path/to/manifest.yml"
			deploymentStatePath = "/path/to/manifest-state.json"
			fakeFs.RegisterOpenFile(deploymentManifestPath, &fakesys.FakeFile{
				Stats: &fakesys.FakeFileStats{FileType: fakesys.FakeFileTypeFile},
			})

			fakeFs.WriteFileString(deploymentManifestPath, "")

			mockDeployer = mock_deployment.NewMockDeployer(mockCtrl)
			mockInstaller = mock_install.NewMockInstaller(mockCtrl)
			mockInstallerFactory = mock_install.NewMockInstallerFactory(mockCtrl)
//.........這裏部分代碼省略.........
開發者ID:hanzhefeng,項目名稱:bosh-init,代碼行數:101,代碼來源:deploy_cmd_test.go

示例13:

	mock_install "github.com/cloudfoundry/bosh-init/installation/mocks"
	"github.com/cloudfoundry/bosh-init/internal/github.com/golang/mock/gomock"
	. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
	"github.com/cloudfoundry/bosh-init/ui"
	fakeui "github.com/cloudfoundry/bosh-init/ui/fakes"
)

var _ = Describe("Installer", func() {
	Describe("WithInstalledCpiRelease", func() {
		var (
			mockCtrl             *gomock.Controller
			mockInstaller        *mocks.MockInstaller
			mockInstallerFactory *mock_install.MockInstallerFactory
			installationManifest biinstallationmanifest.Manifest
			installStage         *fakeui.FakeStage
			installation         *mocks.MockInstallation
			expectInstall        *gomock.Call
			expectCleanup        *gomock.Call
			target               biinstallation.Target
		)

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

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

		BeforeEach(func() {
開發者ID:vestel,項目名稱:bosh-init,代碼行數:31,代碼來源:installer_test.go

示例14:

		mockCtrl = gomock.NewController(GinkgoT())
	})

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

	var (
		mockPackageCompiler *mock_state_package.MockCompiler
		logger              boshlog.Logger

		dependencyCompiler DependencyCompiler

		releaseJobs []bireljob.Job
		fakeStage   *fakebiui.FakeStage

		releasePackage1 *birelpkg.Package
		releasePackage2 *birelpkg.Package

		releaseJob bireljob.Job

		expectCompilePkg1 *gomock.Call
		expectCompilePkg2 *gomock.Call
	)

	BeforeEach(func() {
		mockPackageCompiler = mock_state_package.NewMockCompiler(mockCtrl)

		logger = boshlog.NewLogger(boshlog.LevelNone)
		dependencyCompiler = NewDependencyCompiler(mockPackageCompiler, logger)
開發者ID:hanzhefeng,項目名稱:bosh-init,代碼行數:30,代碼來源:dependency_compiler_test.go

示例15:

				// which would return a nil if the config is empty.
				// So we have to make a fake empty deployment to test it.
				deployment = deploymentFactory.NewDeployment([]biinstance.Instance{}, []bidisk.Disk{}, []bistemcell.CloudStemcell{})
			})

			It("does not delete anything", func() {
				err := deployment.Delete(fakeStage)
				Expect(err).NotTo(HaveOccurred())

				Expect(fakeStage.PerformCalls).To(BeEmpty())
			})
		})

		Context("when VM has been deployed", func() {
			var (
				expectHasVM *gomock.Call
			)
			BeforeEach(func() {
				deploymentStateService.Save(biconfig.DeploymentState{})
				vmRepo.UpdateCurrent("fake-vm-cid")

				expectHasVM = mockCloud.EXPECT().HasVM("fake-vm-cid").Return(true, nil)
			})

			It("stops the agent and deletes the VM", func() {
				gomock.InOrder(
					mockAgentClient.EXPECT().Ping().Return("any-state", nil),                   // ping to make sure agent is responsive
					mockAgentClient.EXPECT().Stop(),                                            // stop all jobs
					mockAgentClient.EXPECT().ListDisk().Return([]string{"fake-disk-cid"}, nil), // get mounted disks to be unmounted
					mockAgentClient.EXPECT().UnmountDisk("fake-disk-cid"),
					mockCloud.EXPECT().DeleteVM("fake-vm-cid"),
開發者ID:vestel,項目名稱:bosh-init,代碼行數:31,代碼來源:deployment_test.go


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