"github.com/cloudfoundry/gosteno"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"

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

var _ = Describe("SyslogSink", func() {
	var (
		syslogSink            *syslog.SyslogSink
		sysLogger             *SyslogWriterRecorder
		syslogSinkRunFinished chan bool
		errorChannel          chan *events.Envelope
		errorHandler          func(string, string)
		inputChan             chan *events.Envelope
		bufferSize            uint
		dialer                *net.Dialer
		logger                *gosteno.Logger
		drainURL              string
	)

	BeforeEach(func() {
		syslogSinkRunFinished = make(chan bool)
		sysLogger = NewSyslogWriterRecorder()
		errorChannel = make(chan *events.Envelope, 10)
		inputChan = make(chan *events.Envelope)
		dialer = &net.Dialer{}
		logger = loggertesthelper.Logger()
		drainURL = "syslog://using-fake"
	"github.com/cloudfoundry/sonde-go/events"

	"net"
	"sync/atomic"

	"github.com/gogo/protobuf/proto"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("SyslogSink", func() {
	var (
		syslogSink            *syslog.SyslogSink
		sysLogger             *SyslogWriterRecorder
		syslogSinkRunFinished chan bool
		errorChannel          chan *events.Envelope
		errorHandler          func(string, string, string)
		inputChan             chan *events.Envelope
		bufferSize            uint
		dialer                *net.Dialer
	)

	BeforeEach(func() {
		syslogSinkRunFinished = make(chan bool)
		sysLogger = NewSyslogWriterRecorder()
		errorChannel = make(chan *events.Envelope, 10)
		inputChan = make(chan *events.Envelope)
		dialer = &net.Dialer{}

		errorHandler = func(errorMsg string, appId string, drainUrl string) {
			logMessage := factories.NewLogMessage(events.LogMessage_ERR, errorMsg, appId, "LGR")
			envelope, _ := emitter.Wrap(logMessage, "dropsonde-origin")
	"github.com/cloudfoundry/dropsonde/emitter"
	"github.com/cloudfoundry/dropsonde/factories"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/sonde-go/events"

	"github.com/gogo/protobuf/proto"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("SyslogSink", func() {
	var (
		syslogSink            *syslog.SyslogSink
		sysLogger             *SyslogWriterRecorder
		syslogSinkRunFinished chan bool
		errorChannel          chan *events.Envelope
		errorHandler          func(string, string, string)
		inputChan             chan *events.Envelope
		updateMetricChan      chan int64
	)

	BeforeEach(func() {
		syslogSinkRunFinished = make(chan bool)
		sysLogger = NewSyslogWriterRecorder()
		errorChannel = make(chan *events.Envelope, 10)
		inputChan = make(chan *events.Envelope)

		errorHandler = func(errorMsg string, appId string, drainUrl string) {
			logMessage := factories.NewLogMessage(events.LogMessage_ERR, errorMsg, appId, "LGR")
			envelope, _ := emitter.Wrap(logMessage, "dropsonde-origin")