示例#1
0
			BeforeEach(func() {
				request = models.FailActualLRPRequest{
					ActualLrpKey: &models.ActualLRPKey{ProcessGuid: "p-guid", Index: 2, Domain: "domain"},
					ErrorMessage: "string",
				}
			})

			Context("when valid", func() {
				It("returns nil", func() {
					Expect(request.Validate()).To(BeNil())
				})
			})

			Context("when the ActualLrpKey is blank", func() {
				BeforeEach(func() {
					request.ActualLrpKey = nil
				})

				It("returns a validation error", func() {
					Expect(request.Validate()).To(ConsistOf(models.ErrInvalidField{"actual_lrp_key"}))
				})
			})

			Context("when the ActualLrpKey is invalid", func() {
				BeforeEach(func() {
					request.ActualLrpKey.ProcessGuid = ""
				})

				It("returns a validation error", func() {
					Expect(request.Validate()).To(ConsistOf(models.ErrInvalidField{"process_guid"}))
				})
示例#2
0
		var (
			request   models.FailActualLRPRequest
			failErr   *models.Error
			actualLRP *models.ActualLRP

			lrpKey       models.ActualLRPKey
			instanceKey  models.ActualLRPInstanceKey
			errorMessage string

			processGuid string
			index       int32
			domain      string
		)

		JustBeforeEach(func() {
			request.ActualLrpKey = &lrpKey
			request.ErrorMessage = errorMessage
			failErr = etcdDB.FailActualLRP(logger, &request)
		})

		Context("when the actual LRP exists", func() {
			BeforeEach(func() {
				processGuid = "some-process-guid"
				index = 1
				domain = "some-domain"
				errorMessage = "some-error"

				lrpKey = models.NewActualLRPKey(processGuid, index, domain)
				actualLRP = &models.ActualLRP{
					ActualLRPKey: lrpKey,
					State:        models.ActualLRPStateUnclaimed,