Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update golden files for icinga/startup test to exclude timestamp #9506

Merged
merged 1 commit into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions filebeat/module/icinga/startup/test/test.log-expected.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[
{
"@timestamp": "2018-11-06T18:29:13.579Z",
"event.dataset": "startup",
"event.module": "icinga",
"icinga.startup.facility": "cli",
Expand All @@ -10,7 +9,6 @@
"log.offset": 0
},
{
"@timestamp": "2018-11-06T18:29:13.579Z",
"event.dataset": "startup",
"event.module": "icinga",
"icinga.startup.facility": "cli",
Expand Down
10 changes: 5 additions & 5 deletions filebeat/tests/system/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def _test_expected_events(self, test_file, objects):
for k, obj in enumerate(objects):
objects[k] = self.flatten_object(obj, {}, "")
clean_keys(objects[k])

json.dump(objects, f, indent=4, sort_keys=True)

with open(test_file + "-expected.json", "r") as f:
Expand All @@ -175,11 +176,6 @@ def _test_expected_events(self, test_file, objects):
obj = self.flatten_object(obj, {}, "")
clean_keys(obj)

# Remove timestamp for comparison where timestamp is not part of the log line
if obj["event.module"] == "icinga" and obj["event.dataset"] == "startup":
delete_key(obj, "@timestamp")
delete_key(ev, "@timestamp")

if ev == obj:
found = True
break
Expand All @@ -199,6 +195,10 @@ def clean_keys(obj):
for key in host_keys + time_keys + other_keys:
delete_key(obj, key)

# Remove timestamp for comparison where timestamp is not part of the log line
if obj["event.module"] == "icinga" and obj["event.dataset"] == "startup":
delete_key(obj, "@timestamp")


def delete_key(obj, key):
if key in obj:
Expand Down