本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/agent/applier/bundlecollection/fakes.FakeBundle.EnableError方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeBundle.EnableError方法的具体用法?Golang FakeBundle.EnableError怎么用?Golang FakeBundle.EnableError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-agent/agent/applier/bundlecollection/fakes.FakeBundle
的用法示例。
在下文中一共展示了FakeBundle.EnableError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
//.........这里部分代码省略.........
})
Describe("Apply", func() {
act := func() error { return applier.Apply(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 but only enables job", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(bundle.ActionsCalled).To(Equal([]string{"Enable"})) // no Install
})
It("returns error when job enable fails", func() {
bundle.EnableError = errors.New("fake-enable-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-enable-error"))
})
It("does not download the job template", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(blobstore.GetBlobIDs).To(BeNil())
})
ItUpdatesPackages(act)
})
Context("when job is not installed", func() {
BeforeEach(func() {
bundle.Installed = false
})
It("installs and enables job", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(bundle.ActionsCalled).To(Equal([]string{"Install", "Enable"}))
})
It("returns error when job enable fails", func() {
bundle.EnableError = errors.New("fake-enable-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-enable-error"))
示例2: init
//.........这里部分代码省略.........
})
Describe("Apply", func() {
act := func() error { return applier.Apply(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 but only enables package", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(bundle.ActionsCalled).To(Equal([]string{"Enable"})) // no Install
})
It("returns error when package enable fails", func() {
bundle.EnableError = errors.New("fake-enable-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-enable-error"))
})
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 and enables package", func() {
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(bundle.ActionsCalled).To(Equal([]string{"Install", "Enable"}))
})
It("returns error when package enable fails", func() {
bundle.EnableError = errors.New("fake-enable-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-enable-error"))
})