本文整理匯總了Golang中github.com/cloudfoundry/bosh-init/ui/fakes.NewFakeStage函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewFakeStage函數的具體用法?Golang NewFakeStage怎麽用?Golang NewFakeStage使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewFakeStage函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
// installing steps handled by installer.Install()
// deleting steps handled by deployment.Delete()
}
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
fs.EnableStrictTempRootBehavior()
logger = boshlog.NewLogger(boshlog.LevelNone)
fakeUUIDGenerator = fakeuuid.NewFakeGenerator()
setupDeploymentStateService = biconfig.NewFileSystemDeploymentStateService(fs, fakeUUIDGenerator, logger, biconfig.DeploymentStatePath(deploymentManifestPath))
deploymentStatePath = biconfig.DeploymentStatePath(deploymentManifestPath)
setupDeploymentStateService.Load()
fakeUI = &fakeui.FakeUI{}
fakeStage = fakebiui.NewFakeStage()
mockCloud = mock_cloud.NewMockCloud(mockCtrl)
mockCloudFactory = mock_cloud.NewMockFactory(mockCtrl)
mockCpiInstaller = mock_install.NewMockInstaller(mockCtrl)
mockCpiUninstaller = mock_install.NewMockUninstaller(mockCtrl)
mockInstallerFactory = mock_install.NewMockInstallerFactory(mockCtrl)
fakeInstallation = &fakecmd.FakeInstallation{}
mockBlobstoreFactory = mock_blobstore.NewMockFactory(mockCtrl)
mockBlobstore = mock_blobstore.NewMockBlobstore(mockCtrl)
mockBlobstoreFactory.EXPECT().Create(mbusURL).Return(mockBlobstore, nil).AnyTimes()
mockDeploymentManagerFactory = mock_deployment.NewMockManagerFactory(mockCtrl)
示例2: 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,
//.........這裏部分代碼省略.........
示例3: rootDesc
//.........這裏部分代碼省略.........
mockRegistryServerManager = mock_registry.NewMockServerManager(mockCtrl)
mockRegistryServer = mock_registry.NewMockServer(mockCtrl)
mockAgentClientFactory = mock_httpagent.NewMockAgentClientFactory(mockCtrl)
mockAgentClient = mock_agentclient.NewMockAgentClient(mockCtrl)
mockAgentClientFactory.EXPECT().NewAgentClient(gomock.Any(), gomock.Any()).Return(mockAgentClient).AnyTimes()
mockCloudFactory = mock_cloud.NewMockFactory(mockCtrl)
mockBlobstoreFactory = mock_blobstore.NewMockFactory(mockCtrl)
mockBlobstore = mock_blobstore.NewMockBlobstore(mockCtrl)
mockBlobstoreFactory.EXPECT().Create(mbusURL, gomock.Any()).Return(mockBlobstore, nil).AnyTimes()
mockVMManagerFactory = mock_vm.NewMockManagerFactory(mockCtrl)
fakeVMManager = fakebivm.NewFakeManager()
mockVMManagerFactory.EXPECT().NewManager(gomock.Any(), mockAgentClient).Return(fakeVMManager).AnyTimes()
fakeStemcellExtractor = fakebistemcell.NewFakeExtractor()
mockStemcellManager = mock_stemcell.NewMockManager(mockCtrl)
fakeStemcellManagerFactory = fakebistemcell.NewFakeManagerFactory()
fakeReleaseSetParser = fakebirelsetmanifest.NewFakeParser()
fakeInstallationParser = fakebiinstallmanifest.NewFakeParser()
fakeDeploymentParser = fakebideplmanifest.NewFakeParser()
mockLegacyDeploymentStateMigrator = mock_config.NewMockLegacyDeploymentStateMigrator(mockCtrl)
configUUIDGenerator = &fakeuuid.FakeGenerator{}
configUUIDGenerator.GeneratedUUID = directorID
setupDeploymentStateService = biconfig.NewFileSystemDeploymentStateService(fakeFs, configUUIDGenerator, logger, biconfig.DeploymentStatePath(deploymentManifestPath))
fakeDeploymentValidator = fakebideplval.NewFakeValidator()
fakeStage = fakebiui.NewFakeStage()
sha1Calculator = crypto.NewSha1Calculator(fakeFs)
fakeUUIDGenerator = &fakeuuid.FakeGenerator{}
var err error
manifestSHA1, err = sha1Calculator.Calculate(deploymentManifestPath)
Expect(err).ToNot(HaveOccurred())
cpiReleaseTarballPath = "/release/tarball/path"
stemcellTarballPath = "/stemcell/tarball/path"
extractedStemcell = bistemcell.NewExtractedStemcell(
bistemcell.Manifest{
ImagePath: "/stemcell/image/path",
Name: "fake-stemcell-name",
Version: "fake-stemcell-version",
SHA1: "fake-stemcell-sha1",
CloudProperties: biproperty.Map{},
OS: "ubuntu-trusty",
},
"fake-extracted-path",
fakeFs,
)
// create input files
fakeFs.WriteFileString(cpiReleaseTarballPath, "")
fakeFs.WriteFileString(stemcellTarballPath, "")
// deployment exists
fakeFs.WriteFileString(deploymentManifestPath, "")
// deployment is valid
示例4:
},
}
ui = &fakeui.FakeUI{}
help = NewHelpCmd(ui, commands)
})
Describe("Name", func() {
It("returns 'help'", func() {
Expect(help.Name()).To(Equal("help"))
})
})
Describe("Run", func() {
Context("when no arguments were passed in", func() {
It("prints generic help", func() {
err := help.Run(fakeui.NewFakeStage(), []string{})
Expect(err).ToNot(HaveOccurred())
expectedOutput := `NAME:
bosh-init - A command line tool to initialize BOSH deployments
USAGE:
bosh-init [global options] <command> [arguments...]
COMMANDS:
complex Complex command... has usage and env
help Show help message
simple Simple command... sorted to the end of the list
GLOBAL OPTIONS:
--help, -h Show help message
示例5:
)
BeforeEach(func() {
mockCtrl = gomock.NewController(GinkgoT())
})
AfterEach(func() {
mockCtrl.Finish()
})
BeforeEach(func() {
mockInstaller = mocks.NewMockInstaller(mockCtrl)
mockInstallerFactory = mock_install.NewMockInstallerFactory(mockCtrl)
installationManifest = biinstallationmanifest.Manifest{}
installStage = fakeui.NewFakeStage()
installation = mocks.NewMockInstallation(mockCtrl)
target = biinstallation.NewTarget("fake-installation-path")
mockInstallerFactory.EXPECT().NewInstaller(target).Return(mockInstaller).AnyTimes()
expectInstall = mockInstaller.EXPECT().Install(installationManifest, gomock.Any())
expectCleanup = mockInstaller.EXPECT().Cleanup(installation).Return(nil)
})
It("should install the CPI and call the passed in function with the installation", func() {
cpiInstaller := release.CpiInstaller{
InstallerFactory: mockInstallerFactory,
}
expectInstall.Return(installation, nil)
示例6:
. "github.com/cloudfoundry/bosh-init/cmd"
)
var _ = Describe("VersionCmd", func() {
var (
ui *fakeui.FakeUI
command Cmd
)
BeforeEach(func() {
ui = &fakeui.FakeUI{}
command = NewVersionCmd(ui)
})
Describe("Name", func() {
It("returns 'version'", func() {
Expect(command.Name()).To(Equal("version"))
})
})
Describe("Run", func() {
It("prints the version", func() {
err := command.Run(fakeui.NewFakeStage(), []string{})
Expect(err).ToNot(HaveOccurred())
Expect(ui.Said).To(Equal([]string{"version [DEV BUILD]"}))
})
})
})