本文整理汇总了Golang中github.com/cloudfoundry/bosh-init/config.DeploymentStateService.Load方法的典型用法代码示例。如果您正苦于以下问题:Golang DeploymentStateService.Load方法的具体用法?Golang DeploymentStateService.Load怎么用?Golang DeploymentStateService.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-init/config.DeploymentStateService
的用法示例。
在下文中一共展示了DeploymentStateService.Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
directorID = "fake-uuid-1"
})
It("creates one", func() {
expectDeployFlow()
// new directorID will be generated
mockAgentClientFactory.EXPECT().NewAgentClient(gomock.Any(), mbusURL).Return(mockAgentClient)
err := newDeployCmd().Run(fakeStage, []string{deploymentManifestPath})
Expect(err).ToNot(HaveOccurred())
Expect(fs.FileExists(deploymentStatePath)).To(BeTrue())
deploymentState, err := deploymentStateService.Load()
Expect(err).ToNot(HaveOccurred())
Expect(deploymentState.DirectorID).To(Equal(directorID))
})
})
Context("when the deployment has been deployed", func() {
JustBeforeEach(func() {
expectDeployFlow()
err := newDeployCmd().Run(fakeStage, []string{deploymentManifestPath})
Expect(err).ToNot(HaveOccurred())
})
Context("when persistent disk size is increased", func() {
JustBeforeEach(func() {
示例2:
},
// mock deployment manager cleanup doesn't add sub-stages
}))
// 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)
示例3: rootDesc
//.........这里部分代码省略.........
Expect(fakeStemcellExtractor.ExtractInputs).To(Equal([]fakebistemcell.ExtractInput{
{TarballPath: stemcellTarballPath},
}))
})
It("uploads the stemcell", func() {
expectStemcellUpload.Times(1)
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).ToNot(HaveOccurred())
})
It("adds a new 'deploying' event logger stage", func() {
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
Expect(fakeStage.PerformCalls[3]).To(Equal(&fakebiui.PerformCall{
Name: "deploying",
Stage: &fakebiui.FakeStage{}, // mock deployer doesn't add sub-stages
}))
})
It("deploys", func() {
expectDeploy.Times(1)
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
})
It("updates the deployment record", func() {
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
deploymentState, err := setupDeploymentStateService.Load()
Expect(err).ToNot(HaveOccurred())
Expect(deploymentState.CurrentManifestSHA1).To(Equal(manifestSHA1))
Expect(deploymentState.Releases).To(Equal([]biconfig.ReleaseRecord{
{
ID: "fake-uuid-0",
Name: fakeCPIRelease.Name(),
Version: fakeCPIRelease.Version(),
},
}))
})
It("deletes unused stemcells", func() {
expectStemcellDeleteUnused.Times(1)
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
})
Context("when deployment has not changed", func() {
JustBeforeEach(func() {
previousDeploymentState := biconfig.DeploymentState{
DirectorID: directorID,
CurrentReleaseIDs: []string{"my-release-id-1"},
Releases: []biconfig.ReleaseRecord{{
ID: "my-release-id-1",
Name: fakeCPIRelease.Name(),
Version: fakeCPIRelease.Version(),
}},
CurrentStemcellID: "my-stemcellRecordID",
Stemcells: []biconfig.StemcellRecord{{
ID: "my-stemcellRecordID",