Esempio n. 1
0
		natsRunner.Start()

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

		sslPort := test_util.NextAvailPort()

		cert, err := tls.LoadX509KeyPair("../test/assets/certs/server.pem", "../test/assets/certs/server.key")
		Expect(err).ToNot(HaveOccurred())

		config = test_util.SpecConfig(statusPort, proxyPort, natsPort)
		config.EnableSSL = true
		config.SSLPort = sslPort
		config.SSLCertificate = cert
		config.CipherSuites = []uint16{tls.TLS_RSA_WITH_AES_256_CBC_SHA}
		config.EndpointTimeout = 5 * time.Second

		mbusClient = natsRunner.MessageBus
		registry = rregistry.NewRouteRegistry(logger, config, new(fakes.FakeRouteRegistryReporter))
		varz = vvarz.NewVarz(registry)
		logcounter := schema.NewLogCounter()
		atomic.StoreInt32(&healthCheck, 0)
		p = proxy.NewProxy(proxy.ProxyArgs{
			Logger:               logger,
			EndpointTimeout:      config.EndpointTimeout,
			Ip:                   config.Ip,
			TraceKey:             config.TraceKey,
			Registry:             registry,
			Reporter:             varz,
			AccessLogger:         &access_log.NullAccessLogger{},
			HealthCheckUserAgent: "HTTP-Monitor/1.1",
Esempio n. 2
0
	RegisterFailHandler(Fail)
	RunSpecs(t, "Proxy Suite")
}

var _ = BeforeEach(func() {
	logger = lagertest.NewTestLogger("test")
	var err error

	crypto, err = secure.NewAesGCM([]byte("ABCDEFGHIJKLMNOP"))
	Expect(err).NotTo(HaveOccurred())

	cryptoPrev = nil

	conf = config.DefaultConfig()
	conf.TraceKey = "my_trace_key"
	conf.EndpointTimeout = 500 * time.Millisecond
	fakeReporter = &fakes.FakeProxyReporter{}
})

var _ = JustBeforeEach(func() {
	var err error
	r = registry.NewRouteRegistry(logger, conf, new(fakes.FakeRouteRegistryReporter))

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

	accessLogFile = new(test_util.FakeFile)
	accessLog = access_log.NewFileAndLoggregatorAccessLogger(logger, "", accessLogFile)
	go accessLog.Run()

	conf.EnableSSL = true