Skip to content

Commit

Permalink
Write unit test for deep_sort
Browse files Browse the repository at this point in the history
  • Loading branch information
ypid-geberit committed Oct 5, 2018
1 parent 48bbfa4 commit eb38146
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/filters/fingerprint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@
end
end

describe "fingerprint string with SHA1 HMAC algorithm on all event fields with deep_sort" do
config <<-CONFIG
filter {
fingerprint {
concatenate_all_fields => true
key => "longencryptionkey"
method => 'SHA1'
deep_sort => true
}
}
CONFIG

# The @timestamp field is specified in this sample event as we need the event contents to be constant for the tests
sample("@timestamp" => "2017-07-26T14:44:27.064Z", "clientip" => "123.123.123.123", "message" => "This is a test message", "log_level" => "INFO", "offset" => 123456789, "type" => "test", "beat" => {"hostname" => "gnu.example.com", "name" => "gnu.example.com", "version" => "5.2.2"}) do
insist { subject.get("fingerprint") } == "e39ef60e5fb431aa7f9847a4591bf1ffe49cd410"
end
end

describe "fingerprint string with SHA1 algorithm and base64 encoding" do
config <<-CONFIG
filter {
Expand Down

0 comments on commit eb38146

Please sign in to comment.