Exemplo n.º 1
0
					}
					crashedActualLRPGroup.Instance.State = models.ActualLRPStateCrashed

					actualLRPGroups := []*models.ActualLRPGroup{
						runningActualLRPGroup,
						evacuatingAndRunningActualLRPGroup,
						evacuatingActualLRPGroup,
						unclaimedActualLRPGroup,
						crashedActualLRPGroup,
					}

					fakeActualLRPDB.ActualLRPGroupsByProcessGuidReturns(actualLRPGroups, nil)
				})

				It("stops all of the corresponding running actual lrps", func() {
					Expect(fakeActualLRPDB.ActualLRPGroupsByProcessGuidCallCount()).To(Equal(1))

					_, processGuid := fakeActualLRPDB.ActualLRPGroupsByProcessGuidArgsForCall(0)
					Expect(processGuid).To(Equal("some-guid"))

					Expect(fakeRepClientFactory.CreateClientCallCount()).To(Equal(2))
					Expect(fakeRepClientFactory.CreateClientArgsForCall(0)).To(Equal("some-address"))
					Expect(fakeRepClientFactory.CreateClientArgsForCall(1)).To(Equal("some-address"))

					Expect(fakeRepClient.StopLRPInstanceCallCount()).To(Equal(2))
					key, instanceKey := fakeRepClient.StopLRPInstanceArgsForCall(0)
					Expect(key).To(Equal(runningActualLRPGroup.Instance.ActualLRPKey))
					Expect(instanceKey).To(Equal(runningActualLRPGroup.Instance.ActualLRPInstanceKey))
					key, instanceKey = fakeRepClient.StopLRPInstanceArgsForCall(1)
					Expect(key).To(Equal(evacuatingAndRunningActualLRPGroup.Instance.ActualLRPKey))
					Expect(instanceKey).To(Equal(evacuatingAndRunningActualLRPGroup.Instance.ActualLRPInstanceKey))