Exemplo n.º 1
0
	})

	Describe("Firehose", func() {
		var envelopeChan chan *events.Envelope
		var errorChan chan error
		var doneChan chan struct{}
		var stopChan chan struct{}

		perform := func() {
			connection = noaa.NewConsumer(trafficControllerUrl, tlsSettings, consumerProxyFunc)
			envelopeChan = make(chan *events.Envelope)
			errorChan = make(chan error, 10)
			stopChan = make(chan struct{})
			doneChan = make(chan struct{})
			go func() {
				connection.Firehose("subscription-id", authToken, envelopeChan, errorChan, stopChan)
				close(doneChan)
			}()
		}

		BeforeEach(func() {
			startFakeTrafficController()
		})

		It("attempts to connect five times", func() {
			fakeHandler.fail = true
			perform()

			fakeHandler.Close()

			Eventually(errorChan, 3).Should(HaveLen(5))
Exemplo n.º 2
0
			})
		})
	})

	Describe("Firehose", func() {
		var envelopeChan chan *events.Envelope
		var errorChan chan error
		var doneChan chan struct{}

		perform := func() {
			cnsmr = noaa.NewConsumer(trafficControllerUrl, tlsSettings, consumerProxyFunc)
			envelopeChan = make(chan *events.Envelope)
			errorChan = make(chan error, 10)
			doneChan = make(chan struct{})
			go func() {
				cnsmr.Firehose("subscription-id", authToken, envelopeChan, errorChan)
				close(doneChan)
			}()
		}

		BeforeEach(func() {
			startFakeTrafficController()
		})

		It("attempts to connect five times", func() {
			fakeHandler.fail = true
			perform()

			fakeHandler.Close()

			Eventually(errorChan, 3).Should(HaveLen(5))