Exemplo n.º 1
0
	"github.com/cloudfoundry/gunk/workpool"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/storeadapter"
	"github.com/cloudfoundry/storeadapter/etcdstoreadapter"

	"doppler/dopplerservice"
	"doppler/dopplerservice/fakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

//go:generate counterfeiter -o fakes/fakestoreadapter.go ../../github.com/cloudfoundry/storeadapter StoreAdapter
var _ = Describe("Finder", func() {
	var finder dopplerservice.Finder

	Context("validation", func() {
		It("returns an error when protocol is invalid", func() {
			_, err := dopplerservice.NewFinder(nil, "bogus", nil, nil, loggertesthelper.Logger())
			Expect(err).To(HaveOccurred())
		})
	})

	Describe("Running", func() {
		var (
			order       chan string
			fakeAdapter *fakes.FakeStoreAdapter
			errChan     chan error
			stopChan    chan bool
		)
Exemplo n.º 2
0
	"strings"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/ginkgo/extensions/table"
	. "github.com/onsi/gomega"

	"github.com/cloudfoundry/gosteno"
	"github.com/cloudfoundry/storeadapter"
)

var _ = Describe("Finder", func() {
	var (
		testLogger           *gosteno.Logger
		protocols            []string
		mockStoreAdapter     *mockStoreAdapter
		port                 int
		preferredDopplerZone string

		finder *dopplerservice.Finder
	)

	BeforeEach(func() {
		preferredDopplerZone = ""
		protocols = nil
		mockStoreAdapter = newMockStoreAdapter()
		port = 1234
		testLogger = gosteno.NewLogger("TestLogger")
	})

	JustBeforeEach(func() {
		finder = dopplerservice.NewFinder(mockStoreAdapter, port, protocols, preferredDopplerZone, testLogger)