import ( "net" "strconv" "doppler/listeners/agentlistener" "github.com/cloudfoundry/loggregatorlib/loggertesthelper" "github.com/cloudfoundry/sonde-go/events" "github.com/gogo/protobuf/proto" . "github.com/onsi/ginkgo" "github.com/onsi/ginkgo/config" . "github.com/onsi/gomega" ) var _ = Describe("AgentListener", func() { var listener agentlistener.Listener var dataChannel <-chan []byte var listenerStopped chan struct{} var address string BeforeEach(func() { listenerStopped = make(chan struct{}) loggertesthelper.TestLoggerSink.Clear() port := 3456 + config.GinkgoConfig.ParallelNode address = net.JoinHostPort("127.0.0.1", strconv.Itoa(port)) listener, dataChannel = agentlistener.NewAgentListener(address, loggertesthelper.Logger(), "agentListener") go func() { listener.Start() close(listenerStopped) }()
"time" "github.com/cloudfoundry/dropsonde/emitter" "github.com/cloudfoundry/dropsonde/factories" "github.com/cloudfoundry/loggregatorlib/loggertesthelper" "github.com/gogo/protobuf/proto" "github.com/nu7hatch/gouuid" ) const address = "127.0.0.1:4567" var _ = Describe("Tcplistener", func() { Context("dropsonde metric emission", func() { var envelopeChan chan *events.Envelope var tlsListener agentlistener.Listener BeforeEach(func() { envelopeChan = make(chan *events.Envelope) tlsListener = tlslistener.New(address, config, envelopeChan, loggertesthelper.Logger()) go tlsListener.Start() }) AfterEach(func() { tlsListener.Stop() }) It("sends all types of messages as a gob", func() { for name, eventType := range events.Envelope_EventType_value { envelope := createEnvelope(events.Envelope_EventType(eventType)) conn := openTLSConnection()