}) 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() { fakeVM.StartErr = bosherr.Error("fake-start-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-start-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("Starting the agent: fake-start-error")) }) }) Context("when waiting for running state fails", func() { var (