It("returns an error when it can't unmarshal", func() { message = []byte("Bad Message") unmarshaller.Write(message) Expect(mockWriter.Events).To(HaveLen(0)) }) }) Context("metrics", func() { BeforeEach(func() { unmarshaller = eventunmarshaller.New(mockWriter, loggertesthelper.Logger()) }) It("emits the correct metrics context", func() { Expect(unmarshaller.Emit().Name).To(Equal("EventUnmarshaller")) }) It("emits a value metric counter", func() { unmarshaller.Write(message) testhelpers.EventuallyExpectMetric(unmarshaller, "valueMetricReceived", 1) Eventually(fakeEventEmitter.GetMessages).Should(HaveLen(1)) Expect(fakeEventEmitter.GetMessages()[0].Event.(*events.CounterEvent)).To(Equal(&events.CounterEvent{ Name: proto.String("EventUnmarshaller.valueMetricReceived"), Delta: proto.Uint64(1), })) }) It("emits a total log message counter", func() { envelope1 := &events.Envelope{