本文整理匯總了Golang中github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem.ChangeTempRootErr方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeFileSystem.ChangeTempRootErr方法的具體用法?Golang FakeFileSystem.ChangeTempRootErr怎麽用?Golang FakeFileSystem.ChangeTempRootErr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem
的用法示例。
在下文中一共展示了FakeFileSystem.ChangeTempRootErr方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: rootDesc
//.........這裏部分代碼省略.........
err := fakeFs.WriteFileString(deploymentStatePath, "{}")
Expect(err).ToNot(HaveOccurred())
expectLegacyMigrate.Times(0)
err = command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
Expect(fakeInstallationParser.ParsePath).To(Equal(deploymentManifestPath))
})
It("migrates the legacy bosh-deployments.yml if manifest-state.json does not exist", func() {
err := fakeFs.RemoveAll(deploymentStatePath)
Expect(err).ToNot(HaveOccurred())
expectLegacyMigrate.Return(true, nil).Times(1)
err = command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
Expect(fakeInstallationParser.ParsePath).To(Equal(deploymentManifestPath))
Expect(stdOut).To(gbytes.Say("Deployment manifest: '/path/to/manifest.yml'"))
Expect(stdOut).To(gbytes.Say("Deployment state: '/path/to/manifest-state.json'"))
Expect(stdOut).To(gbytes.Say("Migrated legacy deployments file: '/path/to/bosh-deployments.yml'"))
})
It("sets the temp root", func() {
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
Expect(fakeFs.TempRootPath).To(Equal("fake-install-dir/fake-installation-id/tmp"))
})
Context("when setting the temp root fails", func() {
It("returns an error", func() {
fakeFs.ChangeTempRootErr = errors.New("fake ChangeTempRootErr")
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Equal("Setting temp root: fake ChangeTempRootErr"))
})
})
It("parses the installation manifest", func() {
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
Expect(fakeInstallationParser.ParsePath).To(Equal(deploymentManifestPath))
})
It("parses the deployment manifest", func() {
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
Expect(fakeDeploymentParser.ParsePath).To(Equal(deploymentManifestPath))
})
It("validates bosh deployment manifest", func() {
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
Expect(fakeDeploymentValidator.ValidateInputs).To(Equal([]fakebideplval.ValidateInput{
{Manifest: boshDeploymentManifest, ReleaseSetManifest: releaseSetManifest},
}))
})
It("validates jobs in manifest refer to job in releases", func() {
err := command.Run(fakeStage, []string{deploymentManifestPath})
Expect(err).NotTo(HaveOccurred())
Expect(fakeDeploymentValidator.ValidateReleaseJobsInputs).To(Equal([]fakebideplval.ValidateReleaseJobsInput{
{Manifest: boshDeploymentManifest, ReleaseManager: releaseManager},
}))
示例2:
})
})
Context("when the deployment has been deployed", func() {
BeforeEach(func() {
directorID = "fake-director-id"
// create deployment manifest yaml file
setupDeploymentStateService.Save(biconfig.DeploymentState{
DirectorID: directorID,
})
})
Context("when change temp root fails", func() {
It("returns an error", func() {
fs.ChangeTempRootErr = errors.New("fake ChangeTempRootErr")
err := newDeploymentDeleter().DeleteDeployment(fakeStage)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Equal("Setting temp root: fake ChangeTempRootErr"))
})
})
It("sets the temp root", func() {
expectDeleteAndCleanup(true)
err := newDeploymentDeleter().DeleteDeployment(fakeStage)
Expect(err).NotTo(HaveOccurred())
Expect(fs.TempRootPath).To(Equal("fake-install-dir/fake-installation-id/tmp"))
})
It("extracts & install CPI release tarball", func() {
expectDeleteAndCleanup(true)