Fixes ruby unit test in case the running host has a default timezone different than UTC, configuring the plugin to use UTC timezone.
Without specifying the timezone in the test, it brings the default from the system. The extraction of year from Logstash's Timestamp is done in UTC timezone:
final int year = this.timestamp.toInstant().atOffset(java.time.ZoneOffset.UTC).getYear();
Creating a timestamp in a timezone different from UTC generates the error:
Failures:
1) LogStash::Filters::Date cancelled events cancelled events list ignores and return ignored cancelled
Failure/Error: expect(result[2].timestamp.year).to eq(uncancelled_year)
expected: 2001
got: 2000
(compared using ==)
# ./spec/filters/date_spec.rb:871:in `block in <main>'
# /usr/share/rvm/gems/jruby-9.2.9.0/gems/logstash-devutils-2.4.0-java/lib/logstash/devutils/rspec/spec_helper.rb:61:in `block in <main>'
Finished in 0.16188 seconds (files took 3.09 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/filters/date_spec.rb:862 # LogStash::Filters::Date cancelled events cancelled events list ignores and return ignored cancelled
Fixes ruby unit test in case the running host has a default timezone different than UTC, configuring the plugin to use UTC timezone.
Without specifying the timezone in the test, it brings the default from the system. The extraction of year from Logstash's Timestamp is done in UTC timezone:
Creating a timestamp in a timezone different from UTC generates the error:
How to test
main
must fail while in this branch success.