本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/agent/applier/bundlecollection/fakes.FakeBundle.IsInstalledErr方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeBundle.IsInstalledErr方法的具体用法?Golang FakeBundle.IsInstalledErr怎么用?Golang FakeBundle.IsInstalledErr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-agent/agent/applier/bundlecollection/fakes.FakeBundle
的用法示例。
在下文中一共展示了FakeBundle.IsInstalledErr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
//.........这里部分代码省略.........
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-apply-err"))
})
It("keeps only currently required packages but does not completely uninstall them", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(len(packageApplier.KeptOnlyPackages)).To(Equal(2)) // present
Expect(packageApplier.KeptOnlyPackages).To(Equal(job.Packages))
})
It("returns error when keeping only currently required packages fails", func() {
packageApplier.KeepOnlyErr = errors.New("fake-keep-only-err")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-keep-only-err"))
})
}
Describe("Prepare", func() {
act := func() error { return applier.Prepare(job) }
It("return an error if getting file bundle fails", func() {
jobsBc.GetErr = errors.New("fake-get-bundle-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-get-bundle-error"))
})
It("returns an error if checking for installed path fails", func() {
bundle.IsInstalledErr = errors.New("fake-is-installed-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-is-installed-error"))
})
Context("when job is already installed", func() {
BeforeEach(func() {
bundle.Installed = true
})
It("does not install", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(bundle.ActionsCalled).To(Equal([]string{})) // no Install
})
It("does not download the job template", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(blobstore.GetBlobIDs).To(BeNil())
})
})
Context("when job is not installed", func() {
BeforeEach(func() {
bundle.Installed = false
})
It("installs job (but does not enable)", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
示例2: init
//.........这里部分代码省略.........
It("installs bundle from decompressed tmp path of a package blob", func() {
fs.TempDirDir = "/fake-tmp-dir"
var installedBeforeDecompression bool
compressor.DecompressFileToDirCallBack = func() {
installedBeforeDecompression = bundle.Installed
}
err := act()
Expect(err).ToNot(HaveOccurred())
// bundle installation did not happen before decompression
Expect(installedBeforeDecompression).To(BeFalse())
// make sure that bundle install happened after decompression
Expect(bundle.InstallSourcePath).To(Equal("/fake-tmp-dir"))
})
}
Describe("Prepare", func() {
act := func() error { return applier.Prepare(pkg) }
It("return an error if getting file bundle fails", func() {
packagesBc.GetErr = errors.New("fake-get-bundle-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-get-bundle-error"))
})
It("returns an error if checking for package installation fails", func() {
bundle.IsInstalledErr = errors.New("fake-is-installed-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-is-installed-error"))
})
Context("when package is already installed", func() {
BeforeEach(func() {
bundle.Installed = true
})
It("does not install", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(bundle.ActionsCalled).To(Equal([]string{})) // no Install
})
It("does not download the package", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(blobstore.GetBlobIDs).To(BeNil())
})
})
Context("when package is not installed", func() {
BeforeEach(func() {
bundle.Installed = false
})
It("installs package (but does not enable it)", func() {
err := act()
Expect(err).ToNot(HaveOccurred())