Ω(err).ShouldNot(HaveOccurred()) Ω(startMessages()).Should(BeEmpty()) Ω(stopMessages()).Should(HaveLen(1)) expectedMessageForEvacuatingInstance := models.NewPendingStopMessage(clock.Now(), 0, conf.GracePeriod(), app.AppGuid, app.AppVersion, evacuatingHeartbeat.InstanceGuid, models.PendingStopMessageReasonEvacuationComplete) Ω(stopMessages()).Should(ContainElement(EqualPendingStopMessage(expectedMessageForEvacuatingInstance))) }) Context("when there are multiple evacuating instances on the evacuating index", func() { var otherEvacuatingHeartbeat models.InstanceHeartbeat BeforeEach(func() { otherEvacuatingHeartbeat = app.InstanceAtIndex(1).Heartbeat() otherEvacuatingHeartbeat.InstanceGuid = models.Guid() otherEvacuatingHeartbeat.State = models.InstanceStateEvacuating heartbeat.InstanceHeartbeats = append(heartbeat.InstanceHeartbeats, otherEvacuatingHeartbeat) store.SyncHeartbeats(heartbeat) }) It("should schedule an immediate stop for both EVACUATING instances", func() { err := analyzer.Analyze() Ω(err).ShouldNot(HaveOccurred()) Ω(startMessages()).Should(BeEmpty()) Ω(stopMessages()).Should(HaveLen(2)) expectedMessageForEvacuatingInstance := models.NewPendingStopMessage(clock.Now(), 0, conf.GracePeriod(), app.AppGuid, app.AppVersion, evacuatingHeartbeat.InstanceGuid, models.PendingStopMessageReasonEvacuationComplete) Ω(stopMessages()).Should(ContainElement(EqualPendingStopMessage(expectedMessageForEvacuatingInstance)))