示例#1
0
				})
			})

			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"}))
				})
			})

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

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

	Describe("ActualLRPKey", func() {
		Describe("Validate", func() {
			var actualLRPKey models.ActualLRPKey

			BeforeEach(func() {
				actualLRPKey = models.NewActualLRPKey("process-guid", 1, "domain")
示例#2
0
			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,
					Since:        clock.Now().UnixNano(),