コード例 #1
0
	. "loggregator/store"
)

var _ = Describe("AppServiceStoreIntegration", func() {
	var (
		incomingChan  chan domain.AppServices
		outAddChan    <-chan domain.AppService
		outRemoveChan <-chan domain.AppService
	)

	BeforeEach(func() {
		adapter := etcdRunner.Adapter()

		incomingChan = make(chan domain.AppServices)
		store := NewAppServiceStore(adapter, incomingChan)
		go store.Run()

		var watcher *AppServiceStoreWatcher
		watcher, outAddChan, outRemoveChan = NewAppServiceStoreWatcher(adapter)
		go watcher.Run()
		ensureWatchersAreHookedUp()
	})

	It("should receive, store, and republish AppServices", func() {
		appServices := domain.AppServices{AppId: "12345", Urls: []string{"syslog://foo"}}
		incomingChan <- appServices

		Expect(<-outAddChan).To(Equal(domain.AppService{
			AppId: "12345", Url: "syslog://foo",
		}))
コード例 #2
0
	. "loggregator/store"
)

var _ = Describe("AppServiceStoreIntegration", func() {
	var (
		incomingChan  chan domain.AppServices
		outAddChan    <-chan domain.AppService
		outRemoveChan <-chan domain.AppService
	)

	BeforeEach(func() {
		adapter := etcdRunner.Adapter()

		incomingChan = make(chan domain.AppServices)
		store := NewAppServiceStore(adapter)
		go store.Run(incomingChan)

		var watcher *AppServiceStoreWatcher
		watcher, outAddChan, outRemoveChan = NewAppServiceStoreWatcher(adapter)
		go watcher.Run()
		ensureWatchersAreHookedUp()
	})

	It("should receive, store, and republish AppServices", func() {
		appServices := domain.AppServices{AppId: "12345", Urls: []string{"syslog://foo"}}
		incomingChan <- appServices

		Expect(<-outAddChan).To(Equal(domain.AppService{
			AppId: "12345", Url: "syslog://foo",
		}))