Ejemplo n.º 1
0
		})

		Context("when has DelaySeconds", func() {
			BeforeEach(func() {
				sqsProperties2.DelaySeconds = "test-delay-seconds"
			})

			It("makes the proper calls", func() {
				_, err := sqsBroker.Update(instanceID, updateDetails, acceptsIncomplete)
				Expect(queue.ModifyQueueDetails.DelaySeconds).To(Equal("test-delay-seconds"))
				Expect(err).ToNot(HaveOccurred())
			})

			Context("and has DelaySeconds Parameter", func() {
				BeforeEach(func() {
					updateDetails.Parameters = map[string]interface{}{"delay_seconds": "test-delay-seconds-parameter"}
				})

				It("makes the proper calls", func() {
					_, err := sqsBroker.Update(instanceID, updateDetails, acceptsIncomplete)
					Expect(queue.ModifyQueueDetails.DelaySeconds).To(Equal("test-delay-seconds-parameter"))
					Expect(err).ToNot(HaveOccurred())
				})

				Context("but user update parameters are not allowed", func() {
					BeforeEach(func() {
						allowUserUpdateParameters = false
					})

					It("makes the proper calls", func() {
						_, err := sqsBroker.Update(instanceID, updateDetails, acceptsIncomplete)
		Context("when request does not accept incomplete", func() {
			BeforeEach(func() {
				acceptsIncomplete = false
			})

			It("returns the proper error", func() {
				_, err := cfBroker.Update(instanceID, updateDetails, acceptsIncomplete)
				Expect(err).To(HaveOccurred())
				Expect(err).To(Equal(brokerapi.ErrAsyncRequired))
			})
		})

		Context("when has user provision parameters", func() {
			BeforeEach(func() {
				updateDetails.Parameters = map[string]interface{}{"test-key-1": "test-value-1", "test-key-2": "test-value-2"}
			})

			It("makes the proper calls", func() {
				_, err := cfBroker.Update(instanceID, updateDetails, acceptsIncomplete)
				Expect(stack.ModifyStackDetails.Parameters).To(Equal(map[string]string{"test-key-1": "test-value-1", "test-key-2": "test-value-2"}))
				Expect(err).ToNot(HaveOccurred())
			})

			Context("but are not allowed", func() {
				BeforeEach(func() {
					allowUserUpdateParameters = false
				})

				It("makes the proper calls", func() {
					_, err := cfBroker.Update(instanceID, updateDetails, acceptsIncomplete)