Skip to content

Commit

Permalink
Fix unittests for new year (influxdata#5213)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenwiltink authored and philipnrmn committed Jan 5, 2019
1 parent b0b15b2 commit 08ea35c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/inputs/logparser/grok/grok_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ func TestNewlineInPatterns(t *testing.T) {
}

func TestSyslogTimestamp(t *testing.T) {
currentYear := time.Now().Year()
tests := []struct {
name string
line string
Expand All @@ -980,17 +981,17 @@ func TestSyslogTimestamp(t *testing.T) {
{
name: "two digit day of month",
line: "Sep 25 09:01:55 value=42",
expected: time.Date(2018, time.September, 25, 9, 1, 55, 0, time.UTC),
expected: time.Date(currentYear, time.September, 25, 9, 1, 55, 0, time.UTC),
},
{
name: "one digit day of month single space",
line: "Sep 2 09:01:55 value=42",
expected: time.Date(2018, time.September, 2, 9, 1, 55, 0, time.UTC),
expected: time.Date(currentYear, time.September, 2, 9, 1, 55, 0, time.UTC),
},
{
name: "one digit day of month double space",
line: "Sep 2 09:01:55 value=42",
expected: time.Date(2018, time.September, 2, 9, 1, 55, 0, time.UTC),
expected: time.Date(currentYear, time.September, 2, 9, 1, 55, 0, time.UTC),
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 08ea35c

Please sign in to comment.