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