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


Golang Call.After方法代碼示例

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


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

示例1:

				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()
			stopCall = mockRegistryServer.EXPECT().Stop().Return(nil)

			logBuffer = gbytes.NewBuffer()
			goLogger := log.New(logBuffer, "", log.LstdFlags)
			logger = boshlog.New(boshlog.LevelWarn, goLogger, goLogger)
			fakeStage = fakebiui.NewFakeStage()
		})

		It("starts the registry before calling the function", func() {
			spyCall.After(startCall)

			err := newInstalation().WithRunningRegistry(logger, fakeStage, func() error {
				spy.Record()
				return nil
			})
			Expect(err).NotTo(HaveOccurred())
		})

		It("performs stages for starting and stopping the registry", func() {
			err := newInstalation().WithRunningRegistry(logger, fakeStage, func() error {
				spy.Record()
				return nil
			})
			Expect(err).NotTo(HaveOccurred())
開發者ID:vestel,項目名稱:bosh-init,代碼行數:30,代碼來源:installation_test.go

示例2:

				Name:          "fake-release-package-name-3",
				Fingerprint:   "fake-release-package-fingerprint-3",
				SHA1:          "fake-release-package-sha1-3",
				Dependencies:  []*birelpkg.Package{releasePackage1},
				ExtractedPath: "/extracted-release-path/extracted_packages/fake-release-package-name-3",
			}

			releaseJob.PackageNames = append(releaseJob.PackageNames, releasePackage3.Name)
			releaseJob.Packages = append(releaseJob.Packages, releasePackage3)
			releaseJobs = []bireljob.Job{releaseJob}
		})

		JustBeforeEach(func() {
			compiledPackageRecord3 := bistatepkg.CompiledPackageRecord{
				BlobID:   "fake-compiled-package-blobstore-id-3",
				BlobSHA1: "fake-compiled-package-sha1-3",
			}
			expectCompilePkg3 = mockPackageCompiler.EXPECT().Compile(releasePackage3).Return(compiledPackageRecord3, false, nil).AnyTimes()
		})

		It("only compiles each package once", func() {
			expectCompilePkg1.Times(1)
			expectCompilePkg2.After(expectCompilePkg1)
			expectCompilePkg3.After(expectCompilePkg1)

			_, err := dependencyCompiler.Compile(releaseJobs, fakeStage)
			Expect(err).ToNot(HaveOccurred())
		})
	})
})
開發者ID:hanzhefeng,項目名稱:bosh-init,代碼行數:30,代碼來源:dependency_compiler_test.go


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