diff --git a/internals/overlord/logstate/forwarder.go b/internals/overlord/logstate/forwarder.go index b8369b881..1edaee00b 100644 --- a/internals/overlord/logstate/forwarder.go +++ b/internals/overlord/logstate/forwarder.go @@ -46,7 +46,7 @@ func newLogForwarder(serviceName string) *logForwarder { } func (f *logForwarder) forward(buffer *servicelog.RingBuffer) { - iterator := buffer.HeadIterator(0) + iterator := buffer.TailIterator() // TODO: don't use the parser, just pull/write bytes from iterator parser := servicelog.NewParser(iterator, 1024 /* TODO*/) diff --git a/internals/overlord/logstate/forwarder_test.go b/internals/overlord/logstate/forwarder_test.go index 1f0d86e33..6778cb24c 100644 --- a/internals/overlord/logstate/forwarder_test.go +++ b/internals/overlord/logstate/forwarder_test.go @@ -33,7 +33,9 @@ func (s *forwarderSuite) TestForwarder(c *C) { recv1, recv2 := make(chan []servicelog.Entry), make(chan []servicelog.Entry) gatherer1 := newLogGathererForTest(nil, 1*time.Microsecond, 5, recv1) + go gatherer1.loop() gatherer2 := newLogGathererForTest(nil, 1*time.Microsecond, 5, recv2) + go gatherer2.loop() forwarder := newLogForwarder(serviceName) go forwarder.forward(ringBuffer) @@ -50,7 +52,7 @@ func (s *forwarderSuite) TestForwarder(c *C) { case entries := <-recv1: c.Assert(entries, HasLen, 1) c.Check(entries[0].Service, Equals, serviceName) - c.Check(entries[0].Message, Equals, message) + c.Check(entries[0].Message, Equals, message+"\n") case <-time.After(10 * time.Millisecond): c.Fatal("timeout waiting to receive logs from gatherer1") } @@ -59,7 +61,7 @@ func (s *forwarderSuite) TestForwarder(c *C) { case entries := <-recv2: c.Assert(entries, HasLen, 1) c.Check(entries[0].Service, Equals, serviceName) - c.Check(entries[0].Message, Equals, message) + c.Check(entries[0].Message, Equals, message+"\n") case <-time.After(10 * time.Millisecond): c.Fatal("timeout waiting to receive logs from gatherer2") }