Пример #1
0
		storeAdapter = fakestoreadapter.New()
		store = storepackage.NewStore(conf, storeAdapter, fakelogger.NewFakeLogger())
		sender = New(store, metricsAccountant, conf, messageBus, fakelogger.NewFakeLogger())
		store.BumpActualFreshness(time.Unix(10, 0))
		store.BumpDesiredFreshness(time.Unix(10, 0))
	})

	Context("when the sender fails to pull messages out of the start queue", func() {
		BeforeEach(func() {
			storeAdapter.ListErrInjector = fakestoreadapter.NewFakeStoreAdapterErrorInjector("start", errors.New("oops"))
		})

		It("should return an error and not send any messages", func() {
			err := sender.Send(timeProvider)
			Ω(err).Should(Equal(errors.New("oops")))
			Ω(messageBus.PublishedMessageCount()).Should(Equal(0))
		})
	})

	Context("when the sender fails to pull messages out of the stop queue", func() {
		BeforeEach(func() {
			storeAdapter.ListErrInjector = fakestoreadapter.NewFakeStoreAdapterErrorInjector("stop", errors.New("oops"))
		})

		It("should return an error and not send any messages", func() {
			err := sender.Send(timeProvider)
			Ω(err).Should(Equal(errors.New("oops")))
			Ω(messageBus.PublishedMessageCount()).Should(Equal(0))
		})
	})
Пример #2
0
		storeAdapter = fakestoreadapter.New()
		store = storepackage.NewStore(conf, storeAdapter, fakelogger.NewFakeLogger())
		sender = New(store, metricsAccountant, conf, messageBus, fakelogger.NewFakeLogger())
		store.BumpActualFreshness(time.Unix(10, 0))
		store.BumpDesiredFreshness(time.Unix(10, 0))
	})

	Context("when the sender fails to pull messages out of the start queue", func() {
		BeforeEach(func() {
			storeAdapter.ListErrInjector = fakestoreadapter.NewFakeStoreAdapterErrorInjector("start", errors.New("oops"))
		})

		It("should return an error and not send any messages", func() {
			err := sender.Send(timeProvider)
			Expect(err).To(Equal(errors.New("oops")))
			Expect(messageBus.PublishedMessageCount()).To(Equal(0))
		})
	})

	Context("when the sender fails to pull messages out of the stop queue", func() {
		BeforeEach(func() {
			storeAdapter.ListErrInjector = fakestoreadapter.NewFakeStoreAdapterErrorInjector("stop", errors.New("oops"))
		})

		It("should return an error and not send any messages", func() {
			err := sender.Send(timeProvider)
			Expect(err).To(Equal(errors.New("oops")))
			Expect(messageBus.PublishedMessageCount()).To(Equal(0))
		})
	})