}) It("logs start and stop events to the eventLogger", func() { err := instance.UpdateJobs(deploymentManifest, fakeStage) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-stop-error")) Expect(fakeStage.PerformCalls[0].Name).To(Equal("Updating instance 'fake-job-name/0'")) Expect(fakeStage.PerformCalls[0].Error).To(HaveOccurred()) Expect(fakeStage.PerformCalls[0].Error.Error()).To(Equal("Stopping the agent: fake-stop-error")) }) }) Context("when applying a new vm state fails", func() { BeforeEach(func() { fakeVM.ApplyErr = bosherr.Error("fake-apply-error") }) It("logs start and stop events to the eventLogger", func() { err := instance.UpdateJobs(deploymentManifest, fakeStage) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-apply-error")) Expect(fakeStage.PerformCalls[0].Name).To(Equal("Updating instance 'fake-job-name/0'")) Expect(fakeStage.PerformCalls[0].Error).To(HaveOccurred()) Expect(fakeStage.PerformCalls[0].Error.Error()).To(Equal("Applying the agent state: fake-apply-error")) }) }) Context("when starting vm fails", func() { BeforeEach(func() {