Ejemplo n.º 1
0
	noaa_errors "github.com/cloudfoundry/noaa/errors"
	"github.com/cloudfoundry/noaa/events"
	"github.com/gogo/protobuf/proto"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Noaa", func() {
	var (
		connection           *noaa.Consumer
		trafficControllerUrl string
		testServer           *httptest.Server
		fakeHandler          *FakeHandler
		tlsSettings          *tls.Config
		consumerProxyFunc    func(*http.Request) (*url.URL, error)

		appGuid        string
		authToken      string
		messagesToSend chan []byte

		err error
	)

	BeforeSuite(func() {
		buf := &bytes.Buffer{}
		log.SetOutput(buf)
	})

	BeforeEach(func() {
		messagesToSend = make(chan []byte, 256)
	})
	"github.com/cloudfoundry/noaa/events"
	"github.com/elazarl/goproxy"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Noaa behind a Proxy", func() {
	var (
		connection        *noaa.Consumer
		endpoint          string
		testServer        *httptest.Server
		tlsSettings       *tls.Config
		consumerProxyFunc func(*http.Request) (*url.URL, error)

		appGuid         string
		authToken       string
		incomingChan    chan *events.Envelope
		messagesToSend  chan []byte
		testProxyServer *httptest.Server
		goProxyHandler  *goproxy.ProxyHttpServer

		err error
	)

	BeforeEach(func() {
		messagesToSend = make(chan []byte, 256)

		testServer = httptest.NewServer(handlers.NewWebsocketHandler(messagesToSend, 100*time.Millisecond, loggertesthelper.Logger()))
		endpoint = "ws://" + testServer.Listener.Addr().String()
		goProxyHandler = goproxy.NewProxyHttpServer()
		goProxyHandler.Logger = log.New(bytes.NewBufferString(""), "", 0)
	noaa_errors "github.com/cloudfoundry/noaa/errors"
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Noaa", func() {
	var (
		cnsmr                *noaa.Consumer
		trafficControllerUrl string
		testServer           *httptest.Server
		fakeHandler          *FakeHandler
		tlsSettings          *tls.Config
		consumerProxyFunc    func(*http.Request) (*url.URL, error)

		appGuid        string
		authToken      string
		messagesToSend chan []byte

		err error
	)

	BeforeSuite(func() {
		buf := &bytes.Buffer{}
		log.SetOutput(buf)
	})

	BeforeEach(func() {
		messagesToSend = make(chan []byte, 256)
	})