Ejemplo n.º 1
0
func registerAddr(reg *registry.RouteRegistry, path string, routeServiceUrl string, addr net.Addr, instanceId string) {
	host, portStr, err := net.SplitHostPort(addr.String())
	Ω(err).NotTo(HaveOccurred())

	port, err := strconv.Atoi(portStr)
	Ω(err).NotTo(HaveOccurred())

	reg.Register(route.Uri(path), route.NewEndpoint("", host, uint16(port), instanceId, nil, -1, routeServiceUrl))
}
Ejemplo n.º 2
0
func appUnregistered(registry *registry.RouteRegistry, app *test.TestApp) bool {
	for _, url := range app.Urls() {
		pool := registry.Lookup(url)
		if pool != nil {
			return false
		}
	}

	return true
}
Ejemplo n.º 3
0
	"github.com/cloudfoundry/yagnats/fakeyagnats"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	fakelogger "vulcan/router/access_log/fakes"
	"vulcan/router/metrics/fakes"
	"vulcan/router/proxy"
	"vulcan/router/registry"
	"vulcan/router/route"
	"vulcan/router/test_util"
)

var _ = Describe("Proxy Unit tests", func() {
	var (
		proxyObj         proxy.Proxy
		fakeAccessLogger *fakelogger.FakeAccessLogger

		r *registry.RouteRegistry
	)

	Context("ServeHTTP", func() {
		BeforeEach(func() {
			tlsConfig := &tls.Config{
				CipherSuites:       conf.CipherSuites,
				InsecureSkipVerify: conf.SSLSkipValidation,
			}

			fakeAccessLogger = &fakelogger.FakeAccessLogger{}

			mbus := fakeyagnats.Connect()
			r = registry.NewRouteRegistry(conf, mbus, new(fakes.FakeRouteReporter))
Ejemplo n.º 4
0
	. "github.com/onsi/gomega"
	"vulcan/router/config"
	"vulcan/router/metrics/fakes"
	"vulcan/router/registry"
	"vulcan/router/route"
	. "vulcan/router/varz"

	"encoding/json"
	"fmt"
	"net/http"
	"time"
)

var _ = Describe("Varz", func() {
	var Varz Varz
	var Registry *registry.RouteRegistry

	BeforeEach(func() {
		Registry = registry.NewRouteRegistry(config.DefaultConfig(), fakeyagnats.Connect(), new(fakes.FakeRouteReporter))
		Varz = NewVarz(Registry)
	})

	It("contains the following items", func() {
		v := Varz

		members := []string{
			"responses_2xx",
			"responses_3xx",
			"responses_4xx",
			"responses_5xx",
			"responses_xxx",
Ejemplo n.º 5
0
	"net"
	"net/http"
	"net/http/httputil"
	"strings"
	"time"
	"vulcan/router/metrics/fakes"
)

var _ = Describe("Router", func() {

	var natsRunner *natsrunner.NATSRunner
	var natsPort uint16
	var config *cfg.Config

	var mbusClient yagnats.NATSConn
	var registry *rregistry.RouteRegistry
	var varz vvarz.Varz
	var router *Router

	BeforeEach(func() {
		natsPort = test_util.NextAvailPort()
		natsRunner = natsrunner.NewNATSRunner(int(natsPort))
		natsRunner.Start()

		fakeEmitter := fake.NewFakeEventEmitter("fake")
		dropsonde.InitializeWithEmitter(fakeEmitter)

		proxyPort := test_util.NextAvailPort()
		statusPort := test_util.NextAvailPort()

		cert, err := tls.LoadX509KeyPair("../test/assets/public.pem", "../test/assets/private.pem")