コード例 #1
0
	"metron/writers/legacyunmarshaller"
	"metron/writers/mocks"

	"github.com/cloudfoundry/loggregatorlib/cfcomponent/instrumentation/testhelpers"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/loggregatorlib/logmessage"
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"

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

var _ = Describe("LegacyUnmarshaller", func() {
	var (
		unmarshaller *legacyunmarshaller.LegacyUnmarshaller
		writer       mocks.MockEnvelopeWriter
	)

	Context("Run", func() {
		BeforeEach(func() {
			writer = mocks.MockEnvelopeWriter{}
			unmarshaller = legacyunmarshaller.New(&writer, loggertesthelper.Logger())
		})

		It("unmarshals bytes on channel into envelopes", func() {
			envelope := &logmessage.LogEnvelope{
				RoutingKey: proto.String("fake-routing-key"),
				Signature:  []byte{1, 2, 3},
				LogMessage: &logmessage.LogMessage{
					Message:     []byte{4, 5, 6},
					MessageType: logmessage.LogMessage_OUT.Enum(),
コード例 #2
0
	"github.com/cloudfoundry/loggregatorlib/logmessage"
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"

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

var _ = Describe("LegacyUnmarshaller", func() {
	var (
		unmarshaller *legacyunmarshaller.LegacyUnmarshaller
		writer       mocks.MockEnvelopeWriter
		fakeSender   *fake.FakeMetricSender
	)

	Context("Run", func() {
		BeforeEach(func() {
			writer = mocks.MockEnvelopeWriter{}
			unmarshaller = legacyunmarshaller.New(&writer, loggertesthelper.Logger())
		})

		It("unmarshals bytes on channel into envelopes", func() {
			envelope := &logmessage.LogEnvelope{
				RoutingKey: proto.String("fake-routing-key"),
				Signature:  []byte{1, 2, 3},
				LogMessage: &logmessage.LogMessage{
					Message:     []byte{4, 5, 6},