示例#1
0
func (s *FilterTestSuite) TestFilter() {
	f := filter.New(2 * time.Second)
	t1sago := s.now.Add(-1 * time.Second)
	t2sago := s.now.Add(-2 * time.Second)
	t3sago := s.now.Add(-3 * time.Second)

	assert.False(s.T(), f.Filter(&gol.LogMessage{
		fields.Start: &t1sago,
		fields.Stop:  &s.now,
	}))
	assert.True(s.T(), f.Filter(&gol.LogMessage{
		fields.Start: &t2sago,
		fields.Stop:  &s.now,
	}))
	assert.True(s.T(), f.Filter(&gol.LogMessage{
		fields.Start: &t3sago,
		fields.Stop:  &s.now,
	}))
}
示例#2
0
func (s *FilterTestSuite) TestFilterNoStop() {
	f := filter.New(1 * time.Second)
	assert.True(s.T(), f.Filter(&gol.LogMessage{
		fields.Start: &s.now,
	}))
}