Skip to content

Commit b016583

Browse files
emmanuelmcuadros
authored andcommitted
Verify Handler interface extension in server_test.go.
1 parent a94b2dd commit b016583

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

server_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,20 @@ func (s *ServerSuite) TestTailFile(c *C) {
4343
c.Check(handler.LastLogParts["hostname"], Equals, "hostname")
4444
c.Check(handler.LastLogParts["tag"], Equals, "tag")
4545
c.Check(handler.LastLogParts["content"], Equals, "content")
46+
c.Check(handler.LastMessageLength, Equals, int64(len(exampleSyslog)))
47+
c.Check(handler.LastError, IsNil)
4648
}
4749

4850
type HandlerMock struct {
4951
LastLogParts syslogparser.LogParts
52+
LastMessageLength int64
53+
LastError error
5054
}
5155

5256
func (self *HandlerMock) Handle(logParts syslogparser.LogParts, msgLen int64, err error) {
5357
self.LastLogParts = logParts
58+
self.LastMessageLength = msgLen
59+
self.LastError = err
5460
}
5561

5662
type ConnMock struct {
@@ -127,4 +133,6 @@ func (s *ServerSuite) TestTcpTimeout(c *C) {
127133
server.Wait()
128134
c.Check(con.isReadDeadline, Equals, true)
129135
c.Check(handler.LastLogParts, IsNil)
136+
c.Check(handler.LastMessageLength, Equals, int64(0))
137+
c.Check(handler.LastError, IsNil)
130138
}

0 commit comments

Comments
 (0)