Esempio n. 1
0
			BeforeEach(func() {
				events := make(chan executor.Event, 1)
				receivedEvents = events

				fakeExecutorSource := new(efakes.FakeEventSource)
				fakeExecutorSource.NextStub = func() (executor.Event, error) {
					ev, ok := <-events
					if !ok {
						return nil, errors.New("nope")
					}

					return ev, nil
				}

				fakeExecutorClient.SubscribeToEventsReturns(fakeExecutorSource, nil)
			})

			It("logs that it succeeded", func() {
				Expect(logger).To(Say(sessionPrefix + "subscribing"))
				Expect(logger).To(Say(sessionPrefix + "succeeded-subscribing"))
			})

			Context("when the event stream closes", func() {
				BeforeEach(func() {
					close(receivedEvents)
				})

				It("closes the operation stream", func() {
					Eventually(stream).Should(BeClosed())
				})