Example #1
0
	"github.com/cloudfoundry/dropsonde/metricbatcher"
	"github.com/cloudfoundry/dropsonde/metrics"
	"github.com/cloudfoundry/gosteno"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/sonde-go/events"
)

var bufferSize uint64

var _ = Describe("Batch Writer", func() {

	var (
		byteWriter      *mockByteWriter
		messageBytes    []byte
		prefixedMessage []byte
		batcher         *batch.Writer
		timeout         time.Duration
		logger          *gosteno.Logger
		sender          *fake.FakeMetricSender
		constructorErr  error
	)

	BeforeEach(func() {
		sender = fake.NewFakeMetricSender()
		metrics.Initialize(sender, metricbatcher.New(sender, time.Millisecond*10))
		byteWriter = newMockByteWriter()
		close(byteWriter.WriteOutput.err)
		messageBytes = []byte("this is a log message")
		timeout = time.Second / 2
		bufferSize = 1024
		logger = loggertesthelper.Logger()
Example #2
0
	"github.com/cloudfoundry/gosteno"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"

	"metron/writers/batch"
)

var bufferSize uint64

var _ = Describe("Batch Writer", func() {

	var (
		byteWriter      *mockBatchChainByteWriter
		droppedCounter  *mockDroppedMessageCounter
		messageBytes    []byte
		prefixedMessage []byte
		batcher         *batch.Writer
		timeout         time.Duration
		logger          *gosteno.Logger
		sender          *fake.FakeMetricSender
		mockBatcher     *mockMetricBatcher
		constructorErr  error
	)

	BeforeEach(func() {
		sender = fake.NewFakeMetricSender()
		droppedCounter = newMockDroppedMessageCounter()
		mockBatcher = newMockMetricBatcher()
		metrics.Initialize(sender, mockBatcher)
		byteWriter = newMockBatchChainByteWriter()
		close(byteWriter.WriteOutput.Err)
		messageBytes = []byte("this is a log message")
		timeout = time.Second / 2