コード例 #1
0
ファイル: proxy_test.go プロジェクト: cloudfoundry/gorouter
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{}))
}
コード例 #2
0
ファイル: helper_test.go プロジェクト: cloudfoundry/gorouter
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
}
コード例 #3
0
ファイル: varz_test.go プロジェクト: cloudfoundry/gorouter
	. "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",