Esempio n. 1
0
func ActualLRPProtoToResponse(actualLRP models.ActualLRP, evacuating bool) receptor.ActualLRPResponse {
	return receptor.ActualLRPResponse{
		ProcessGuid:     actualLRP.GetProcessGuid(),
		InstanceGuid:    actualLRP.GetInstanceGuid(),
		CellID:          actualLRP.GetCellId(),
		Domain:          actualLRP.GetDomain(),
		Index:           int(actualLRP.GetIndex()),
		Address:         actualLRP.GetAddress(),
		Ports:           PortMappingFromProto(actualLRP.GetPorts()),
		State:           actualLRPProtoStateToResponseState(actualLRP.GetState()),
		PlacementError:  actualLRP.GetPlacementError(),
		Since:           actualLRP.GetSince(),
		CrashCount:      int(actualLRP.GetCrashCount()),
		CrashReason:     actualLRP.GetCrashReason(),
		Evacuating:      evacuating,
		ModificationTag: actualLRPProtoModificationTagToResponseModificationTag(actualLRP.GetModificationTag()),
	}
}
Esempio n. 2
0
			BeforeEach(func() {
				before = &models.ActualLRP{
					ActualLRPKey: models.NewActualLRPKey("fake-process-guid", 1, "fake-domain"),
				}
				afterKey = models.ActualLRPKey{}
				afterKey = before.ActualLRPKey
			})

			Context("when the ProcessGuid fields differ", func() {
				BeforeEach(func() {
					before.ProcessGuid = "some-process-guid"
					afterKey.ProcessGuid = "another-process-guid"
				})

				It("is not allowed", func() {
					Expect(before.AllowsTransitionTo(afterKey, before.ActualLRPInstanceKey, before.GetState())).To(BeFalse())
				})
			})

			Context("when the Index fields differ", func() {
				BeforeEach(func() {
					before.Index = 1138
					afterKey.Index = 3417
				})

				It("is not allowed", func() {
					Expect(before.AllowsTransitionTo(afterKey, before.ActualLRPInstanceKey, before.GetState())).To(BeFalse())
				})
			})

			Context("when the Domain fields differ", func() {