package route_test import ( "fmt" "time" "github.com/cloudfoundry-incubator/routing-api/models" "github.com/cloudfoundry/gorouter/route" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Pool", func() { var pool *route.Pool var modTag models.ModificationTag BeforeEach(func() { pool = route.NewPool(2*time.Minute, "") modTag = models.ModificationTag{} }) Context("Put", func() { It("adds endpoints", func() { endpoint := &route.Endpoint{} b := pool.Put(endpoint) Expect(b).To(BeTrue()) }) It("handles duplicate endpoints", func() { endpoint := &route.Endpoint{}
"github.com/cloudfoundry/gorouter/config" "github.com/cloudfoundry/gorouter/metrics/reporter/fakes" "github.com/cloudfoundry/gorouter/route" "encoding/json" "time" ) var _ = Describe("RouteRegistry", func() { var r *RouteRegistry var reporter *fakes.FakeRouteRegistryReporter var fooEndpoint, barEndpoint, bar2Endpoint *route.Endpoint var configObj *config.Config var logger lager.Logger var modTag models.ModificationTag BeforeEach(func() { logger = lagertest.NewTestLogger("test") configObj = config.DefaultConfig() configObj.PruneStaleDropletsInterval = 50 * time.Millisecond configObj.DropletStaleThreshold = 10 * time.Millisecond reporter = new(fakes.FakeRouteRegistryReporter) r = NewRouteRegistry(logger, configObj, reporter) modTag = models.ModificationTag{} fooEndpoint = route.NewEndpoint("12345", "192.168.1.1", 1234, "id1", map[string]string{ "runtime": "ruby18",