RSpec::Matchers.define :be_a_logstash_timestamp_equivalent_to do |expected|
expected = LogStash::Timestamp.new(expected) unless expected.kind_of?(LogStash::Timestamp)
description { "be a LogStash::Timestamp equivalent to #{expected}" }
match do |actual|
actual.kind_of?(LogStash::Timestamp) && actual == expected
end
end
This matcher is used in timestamp expectations to avoid string equality and be portable across different versions of Logstash.
With Logstash PR https://github.com/elastic/logstash/pull/12797 was introduced nanosecond precision and this made fails some plugins test that was based on string compare on timestamps.
Tasks:
[x] move the matcher in logstash-devutils
[x] publish the new version of the gem
[x] update JDBC integration to use the new logstash-devutils
[x] update date filter to use the new logstash-devutils
With the PR on the integration-jdbc and on filter-date the same utility matcher was copied and pasted:
This matcher is used in timestamp expectations to avoid string equality and be portable across different versions of Logstash. With Logstash PR https://github.com/elastic/logstash/pull/12797 was introduced nanosecond precision and this made fails some plugins test that was based on string compare on timestamps.
Tasks:
logstash-devutils
logstash-devutils
logstash-devutils