Eventually(loggertesthelper.TestLoggerSink.LogContents).Should(ContainSubstring("can't forward message")) Eventually(client.SchemeCallCount).Should(Equal(0)) }) }) }) Context("udp client", func() { BeforeEach(func() { client.SchemeReturns("udp") }) It("counts the number of bytes sent", func() { bytes, err := proto.Marshal(envelope) Expect(err).NotTo(HaveOccurred()) client.WriteReturns(len(bytes), nil) n := uint32(len(bytes)) forwarder.Write(envelope) Eventually(func() uint64 { return sender.GetCounter("udp.sentByteCount") }).Should(BeEquivalentTo(n)) }) It("counts the number of messages sent", func() { forwarder.Write(envelope) Eventually(func() uint64 { return sender.GetCounter("udp.sentMessageCount")
Expect(client.SchemeCallCount()).To(Equal(0)) }) }) }) Context("udp client", func() { BeforeEach(func() { client.SchemeReturns("udp") }) It("counts the number of bytes sent", func() { var buffer bytes.Buffer bytes, err := proto.Marshal(envelope) Expect(err).NotTo(HaveOccurred()) client.WriteReturns(len(bytes), nil) n := uint32(len(bytes)) err = binary.Write(&buffer, binary.LittleEndian, n) Expect(err).NotTo(HaveOccurred()) forwarder.Write(envelope) Eventually(func() uint64 { return sender.GetCounter("udp.sentByteCount") }).Should(BeEquivalentTo(n)) }) It("counts the number of messages sent", func() { var buffer bytes.Buffer bytes, err := proto.Marshal(envelope)