本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/jobsupervisor/fakes.FakeJobSupervisor.RemovedAllJobsErr方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeJobSupervisor.RemovedAllJobsErr方法的具体用法?Golang FakeJobSupervisor.RemovedAllJobsErr怎么用?Golang FakeJobSupervisor.RemovedAllJobsErr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-agent/jobsupervisor/fakes.FakeJobSupervisor
的用法示例。
在下文中一共展示了FakeJobSupervisor.RemovedAllJobsErr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
//.........这里部分代码省略.........
It("reloads job supervisor", func() {
job1 := models.Job{Name: "fake-job-name-1", Version: "fake-version-name-1"}
job2 := models.Job{Name: "fake-job-name-2", Version: "fake-version-name-2"}
jobs := []models.Job{job1, job2}
err := applier.ConfigureJobs(&fakeas.FakeApplySpec{JobResults: jobs})
Expect(err).ToNot(HaveOccurred())
Expect(jobSupervisor.Reloaded).To(BeTrue())
})
It("configures jobs", func() {
job1 := models.Job{Name: "fake-job-name-1", Version: "fake-version-name-1"}
job2 := models.Job{Name: "fake-job-name-2", Version: "fake-version-name-2"}
jobs := []models.Job{job1, job2}
err := applier.ConfigureJobs(&fakeas.FakeApplySpec{JobResults: jobs})
Expect(err).ToNot(HaveOccurred())
Expect(jobApplier.ConfiguredJobs).To(ConsistOf(job1, job2))
})
})
Describe("Apply", func() {
It("removes all jobs from job supervisor", func() {
err := applier.Apply(&fakeas.FakeApplySpec{}, &fakeas.FakeApplySpec{})
Expect(err).ToNot(HaveOccurred())
Expect(jobSupervisor.RemovedAllJobs).To(BeTrue())
})
It("removes all previous jobs from job supervisor before starting to apply jobs", func() {
// force remove all error
jobSupervisor.RemovedAllJobsErr = errors.New("fake-remove-all-jobs-error")
job := buildJob()
applier.Apply(
&fakeas.FakeApplySpec{},
&fakeas.FakeApplySpec{JobResults: []models.Job{job}},
)
// check that jobs were not applied before removing all other jobs
Expect(jobApplier.AppliedJobs).To(Equal([]models.Job{}))
})
It("returns error if removing all jobs from job supervisor fails", func() {
jobSupervisor.RemovedAllJobsErr = errors.New("fake-remove-all-jobs-error")
err := applier.Apply(&fakeas.FakeApplySpec{}, &fakeas.FakeApplySpec{})
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-remove-all-jobs-error"))
})
It("apply applies jobs", func() {
job := buildJob()
err := applier.Apply(
&fakeas.FakeApplySpec{},
&fakeas.FakeApplySpec{JobResults: []models.Job{job}},
)
Expect(err).ToNot(HaveOccurred())
Expect(jobApplier.AppliedJobs).To(Equal([]models.Job{job}))
})
It("apply errs when applying jobs errs", func() {
job := buildJob()