示例#1
0
	"strconv"

	"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"

	"doppler/listeners"
)

var _ = Describe("AgentListener", func() {
	var (
		listener        listeners.Listener
		dataChannel     <-chan []byte
		listenerStopped chan struct{}
		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 = listeners.NewUDPListener(address, loggertesthelper.Logger(), "udpListener")
		go func() {
			listener.Start()
			close(listenerStopped)
		}()
示例#2
0
	"doppler/listeners"
	"fmt"
	"net"
	"net/http"
	"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"
)

var _ = Describe("TLSlistener", func() {
	var envelopeChan chan *events.Envelope
	var tlsListener listeners.Listener
	var tlsListenerConfig config.TLSListenerConfig
	var tlsClientConfig *tls.Config

	BeforeEach(func() {
		tlsListenerConfig = config.TLSListenerConfig{
			CertFile: "fixtures/server.crt",
			KeyFile:  "fixtures/server.key",
			CAFile:   "fixtures/loggregator-ca.crt",
		}

		var err error
		tlsClientConfig, err = listeners.NewTLSConfig("fixtures/client.crt", "fixtures/client.key", "fixtures/loggregator-ca.crt")
		Expect(err).NotTo(HaveOccurred())
		tlsClientConfig.ServerName = "doppler"
	"doppler/listeners"
	"fmt"
	"net"
	"net/http"
	"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"
)

var _ = Describe("Tcplistener", func() {
	var envelopeChan chan *events.Envelope
	var tlsListener listeners.Listener

	BeforeEach(func() {
		envelopeChan = make(chan *events.Envelope)
		var err error
		tlsListener, err = listeners.NewTLSListener("aname", "127.0.0.1:0", tlsconfig, envelopeChan, loggertesthelper.Logger())
		Expect(err).NotTo(HaveOccurred())
		go tlsListener.Start()
	})

	AfterEach(func() {
		tlsListener.Stop()
	})

	Context("dropsonde metric emission", func() {
		BeforeEach(func() {
示例#4
0
	"github.com/cloudfoundry/dropsonde/factories"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"
	"github.com/nu7hatch/gouuid"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"doppler/config"
	"doppler/listeners"
)

var _ = Describe("TCPlistener", func() {
	var (
		listener          listeners.Listener
		envelopeChan      chan *events.Envelope
		tlsListenerConfig *config.TLSListenerConfig
		tlsClientConfig   *tls.Config
	)

	BeforeEach(func() {
		tlsListenerConfig = &config.TLSListenerConfig{
			CertFile: "fixtures/server.crt",
			KeyFile:  "fixtures/server.key",
			CAFile:   "fixtures/loggregator-ca.crt",
		}

		var err error
		tlsClientConfig, err = listeners.NewTLSConfig(
			"fixtures/client.crt",
			"fixtures/client.key",
			"fixtures/loggregator-ca.crt",