"time"

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

	"metron/writers/mocks"

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

var _ = Describe("MessageAggregator", func() {
	var (
		mockWriter        *mocks.MockEnvelopeWriter
		messageAggregator *messageaggregator.MessageAggregator
		originalTTL       time.Duration
	)

	BeforeEach(func() {
		mockWriter = &mocks.MockEnvelopeWriter{}
		messageAggregator = messageaggregator.New(mockWriter, loggertesthelper.Logger())
		originalTTL = messageaggregator.MaxTTL
	})

	AfterEach(func() {
		messageaggregator.MaxTTL = originalTTL
	})

	It("passes non-marshallable messages through", func() {
		inputMessage := &events.Envelope{}
	. "github.com/apoydence/eachers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/cloudfoundry/dropsonde/metric_sender/fake"
	"github.com/cloudfoundry/dropsonde/metrics"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"
)

var _ = Describe("MessageAggregator", func() {
	var (
		mockWriter        *mocks.MockEnvelopeWriter
		messageAggregator *messageaggregator.MessageAggregator
		originalTTL       time.Duration
	)

	BeforeEach(func() {
		mockWriter = &mocks.MockEnvelopeWriter{}
		messageAggregator = messageaggregator.New(
			mockWriter,
			loggertesthelper.Logger(),
		)
		originalTTL = messageaggregator.MaxTTL
	})

	AfterEach(func() {
		messageaggregator.MaxTTL = originalTTL
	})
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"

	"metron/writers/mocks"

	"github.com/cloudfoundry/dropsonde/metric_sender/fake"
	"github.com/cloudfoundry/dropsonde/metricbatcher"
	"github.com/cloudfoundry/dropsonde/metrics"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("MessageAggregator", func() {
	var (
		mockWriter        *mocks.MockEnvelopeWriter
		messageAggregator *messageaggregator.MessageAggregator
		originalTTL       time.Duration
	)

	BeforeEach(func() {
		mockWriter = &mocks.MockEnvelopeWriter{}
		messageAggregator = messageaggregator.New(mockWriter, loggertesthelper.Logger())
		originalTTL = messageaggregator.MaxTTL
	})

	AfterEach(func() {
		messageaggregator.MaxTTL = originalTTL
	})

	It("does not pass messages with no event type through", func() {
		inputMessage := &events.Envelope{}