expectCheckAfterInterval(fakeStep2, unhealthyInterval)
					Eventually(performErr).Should(Receive(MatchError("not up yet!")))
				})

				It("logs the step", func() {
					expectCheckAfterInterval(fakeStep1, unhealthyInterval)
					expectCheckAfterInterval(fakeStep2, unhealthyInterval)
					Eventually(logger.TestSink.LogMessages).Should(ConsistOf([]string{
						"test.monitor-step.timed-out-before-healthy",
					}))
				})

				It("emits a log message explaining the timeout", func() {
					expectCheckAfterInterval(fakeStep1, unhealthyInterval)
					expectCheckAfterInterval(fakeStep2, unhealthyInterval)
					Eventually(fakeStreamer.Stderr().(*gbytes.Buffer)).Should(gbytes.Say(
						fmt.Sprintf("Timed out after %s: health check never passed.\n", startTimeout),
					))
				})
			})

			Context("and the unhealthy interval passes", func() {
				JustBeforeEach(func() {
					expectCheckAfterInterval(fakeStep1, unhealthyInterval)
				})

				It("does not emit an unhealthy event", func() {
					Consistently(hasBecomeHealthy).ShouldNot(Receive())
				})

				It("does not exit", func() {
Beispiel #2
0
				Context("when an artifact is not specified", func() {
					It("does not stream the upload information", func() {
						err := step.Perform()
						Expect(err).NotTo(HaveOccurred())

						stdout := fakeStreamer.Stdout().(*gbytes.Buffer)
						Expect(stdout.Contents()).To(BeEmpty())
					})
				})

				It("does not stream an error", func() {
					err := step.Perform()
					Expect(err).NotTo(HaveOccurred())

					stderr := fakeStreamer.Stderr().(*gbytes.Buffer)
					Expect(stderr.Contents()).To(BeEmpty())
				})
			})

			Context("when there is an error uploading", func() {
				errUploadFailed := errors.New("Upload failed!")

				BeforeEach(func() {
					fakeUploader := new(fake_uploader.FakeUploader)
					fakeUploader.UploadReturns(0, errUploadFailed)
					uploader = fakeUploader
				})

				It("returns the appropriate error", func() {
					err := step.Perform()