示例#1
0
		It("should close the app store chan when stopped", func() {
			sinkManager.Stop()
			Eventually(appServicesChan).Should(BeClosed())
		})
	})

	Context("With updates from appstore", func() {

		var metrics *metrics.SinkManagerMetrics
		var numSyslogSinks func() int

		BeforeEach(func() {
			metrics = sinkManager.Metrics
			numSyslogSinks = func() int {
				metrics.RLock()
				defer metrics.RUnlock()
				return metrics.SyslogSinks
			}
		})

		Context("When an add update is received", func() {
			It("Should create a new syslog sink from the newAppServicesChan", func() {
				initialNumSinks := numSyslogSinks()
				newAppServiceChan <- domain.AppService{AppId: "aptastic", Url: "https://localhost:884"}

				Eventually(numSyslogSinks).Should(Equal(initialNumSinks + 1))
			})

			Context("With an invalid drain Url", func() {
				var errorSink *ChannelSink