本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/jobsupervisor/fakes.FakeJobSupervisor.UnmonitorErr方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeJobSupervisor.UnmonitorErr方法的具体用法?Golang FakeJobSupervisor.UnmonitorErr怎么用?Golang FakeJobSupervisor.UnmonitorErr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-agent/jobsupervisor/fakes.FakeJobSupervisor
的用法示例。
在下文中一共展示了FakeJobSupervisor.UnmonitorErr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
})
})
Context("when apply spec is not provided", func() {
It("returns error", func() {
value, err := action.Run(DrainTypeUpdate)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("Drain update requires new spec"))
Expect(value).To(Equal(0))
})
})
})
Context("when unmonitoring services fails", func() {
It("returns error", func() {
jobSupervisor.UnmonitorErr = errors.New("fake-unmonitor-error")
value, err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-unmonitor-error"))
Expect(value).To(Equal(0))
})
})
})
Context("when current agent spec does not have a job spec template", func() {
It("returns 0 and does not run drain script", func() {
specService.Spec = boshas.V1ApplySpec{}
value, err := act()
Expect(err).ToNot(HaveOccurred())
示例2: init
//.........这里部分代码省略.........
value, err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-drain-run-error"))
Expect(value).To(Equal(0))
})
})
})
Context("when drain script does not exist", func() {
It("returns 0", func() {
drainScriptProvider.NewDrainScriptDrainScript.ExistsBool = false
value, err := act()
Expect(err).ToNot(HaveOccurred())
Expect(value).To(Equal(0))
Expect(drainScriptProvider.NewDrainScriptDrainScript.DidRun).To(BeFalse())
})
})
})
Context("when apply spec is not provided", func() {
It("returns error", func() {
value, err := action.Run(DrainTypeUpdate)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("Drain update requires new spec"))
Expect(value).To(Equal(0))
})
})
})
Context("when unmonitoring services fails", func() {
It("returns error", func() {
jobSupervisor.UnmonitorErr = errors.New("fake-unmonitor-error")
value, err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-unmonitor-error"))
Expect(value).To(Equal(0))
})
})
})
Context("when current agent spec does not have a job spec template", func() {
It("returns 0 and does not run drain script", func() {
specService.Spec = boshas.V1ApplySpec{}
value, err := act()
Expect(err).ToNot(HaveOccurred())
Expect(value).To(Equal(0))
Expect(drainScriptProvider.NewDrainScriptDrainScript.DidRun).To(BeFalse())
})
})
})
Context("when drain shutdown is requested", func() {
act := func() (int, error) { return action.Run(DrainTypeShutdown) }
Context("when current agent has a job spec template", func() {
var currentSpec boshas.V1ApplySpec
BeforeEach(func() {
currentSpec = boshas.V1ApplySpec{}
currentSpec.JobSpec.Template = "foo"
specService.Spec = currentSpec