It("returns first unmonitor error", func() { err := monit.Unmonitor() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-unmonitor-error")) }) It("only tries to unmonitor services before the first unmonitor error", func() { err := monit.Unmonitor() Expect(err).To(HaveOccurred()) Expect(client.ServicesInGroupName).To(Equal("vcap")) Expect(client.UnmonitorServiceNames).To(Equal([]string{"fake-srv-1", "fake-srv-2"})) }) }) Context("when failed retrieving list of services", func() { It("returns error", func() { client.ServicesInGroupErr = errors.New("fake-services-error") err := monit.Unmonitor() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-services-error")) }) }) }) }) func advanceTime(timeService *fakeclock.FakeClock, duration time.Duration, watcherCount int) { Eventually(timeService.WatcherCount).Should(Equal(watcherCount)) timeService.Increment(duration) }