本文整理匯總了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"))
})