Пример #1
0
func closeHub(logger lager.Logger, hub event.Hub) ifrit.Runner {
	return ifrit.RunFunc(func(signals <-chan os.Signal, ready chan<- struct{}) error {
		logger.Info("starting")
		defer logger.Info("finished")

		close(ready)
		logger.Info("started")

		<-signals
		logger.Info("shutting-down")
		hub.Close()

		return nil
	})
}
	Fn func() `json:"fn"`
}

func (unmarshalableEvent) EventType() receptor.EventType {
	return "unmarshalable"
}

func (unmarshalableEvent) Key() string {
	return "unmarshalable"
}

var _ = Describe("Event Stream Handlers", func() {
	var (
		logger lager.Logger
		hub    event.Hub

		handler *handlers.EventStreamHandler

		server *httptest.Server
	)

	BeforeEach(func() {
		hub = event.NewHub()

		logger = lager.NewLogger("test")
		logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))

		handler = handlers.NewEventStreamHandler(hub, logger)
	})

	AfterEach(func() {
		hub.Close()