Skip to content

Commit

Permalink
Merge pull request #3222 from fluent/fix-2020-time-test
Browse files Browse the repository at this point in the history
test_parser_syslog: Fix 2020-year failure
  • Loading branch information
repeatedly authored Jan 5, 2021
2 parents 22edad6 + 47a9515 commit aba55d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/plugin/test_parser_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_parse_with_time_format(param)
data('regexp' => 'regexp', 'string' => 'string')
def test_parse_with_time_format2(param)
@parser.configure('time_format' => '%Y-%m-%dT%H:%M:%SZ', 'parser_type' => param)
@parser.instance.parse('2020-03-03T10:14:29Z 192.168.0.1 fluentd[11111]: [error] Syslog test') { |time, record|
@parser.instance.parse("#{Time.now.year}-03-03T10:14:29Z 192.168.0.1 fluentd[11111]: [error] Syslog test") { |time, record|
assert_equal(event_time('Mar 03 10:14:29', format: '%b %d %H:%M:%S'), time)
assert_equal(@expected, record)
}
Expand All @@ -47,7 +47,7 @@ def test_parse_with_time_format2(param)

def test_parse_with_time_format_rfc5424
@parser.configure('time_format' => '%Y-%m-%dT%H:%M:%SZ', 'message_format' => 'rfc5424')
@parser.instance.parse('2020-03-03T10:14:29Z 192.168.0.1 fluentd 11111 - - [error] Syslog test') { |time, record|
@parser.instance.parse("#{Time.now.year}-03-03T10:14:29Z 192.168.0.1 fluentd 11111 - - [error] Syslog test") { |time, record|
assert_equal(event_time('Mar 03 10:14:29', format: '%b %d %H:%M:%S'), time)
assert_equal(@expected.merge('host' => '192.168.0.1', 'msgid' => '-', 'extradata' => '-'), record)
}
Expand Down

0 comments on commit aba55d2

Please sign in to comment.