func registerAddr(reg *registry.RouteRegistry, path string, routeServiceUrl string, addr net.Addr, instanceId, instanceIndex, appId string) { host, portStr, err := net.SplitHostPort(addr.String()) Expect(err).NotTo(HaveOccurred()) port, err := strconv.Atoi(portStr) Expect(err).NotTo(HaveOccurred()) reg.Register(route.Uri(path), route.NewEndpoint(appId, host, uint16(port), instanceId, instanceIndex, nil, -1, routeServiceUrl, models.ModificationTag{})) }
func appUnregistered(registry *registry.RouteRegistry, app *common.TestApp) bool { for _, url := range app.Urls() { pool := registry.Lookup(url) if pool != nil { return false } } return true }
. "code.cloudfoundry.org/gorouter/varz" "code.cloudfoundry.org/lager" "code.cloudfoundry.org/lager/lagertest" "code.cloudfoundry.org/routing-api/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "encoding/json" "fmt" "net/http" "time" ) var _ = Describe("Varz", func() { var Varz Varz var Registry *registry.RouteRegistry var logger lager.Logger BeforeEach(func() { logger = lagertest.NewTestLogger("test") Registry = registry.NewRouteRegistry(logger, config.DefaultConfig(), new(fakes.FakeRouteRegistryReporter)) Varz = NewVarz(Registry) }) It("contains the following items", func() { v := Varz members := []string{ "responses_2xx", "responses_3xx", "responses_4xx",