-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Enable and fix Journalbeat integration tests #20140
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e4daeaa
Enable system tests for Journalbeat
kvch 2a15efd
adjust tests
kvch 0423e2b
fix python code
kvch 82dab9f
run python tests for journalbeat
kvch 652f50a
add context to error message
kvch 40274c4
add new registry file possibly compatible
kvch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
update_time: 2018-09-11T10:06:50.895829905Z | ||
journal_entries: | ||
- path: /home/n/go/src/github.com/elastic/beats/journalbeat/tests/system/input/test.journal | ||
cursor: s=7d22fd7aa0c7482d88c303f47d5f32dc;i=2fcb;b=902dc834f07d4f41ade064f6b2ef8b4f;m=1bf0ff5c6d;t=55913a25fe765;x=c7e6480eec30822b | ||
realtime_timestamp: 1505315746998117 | ||
monotonic_timestamp: 120007384173 | ||
cursor: s=018329e08e3a45a0ae03694421c4f553;i=2015d;b=fa3c2e3080dc4cd5be5cb5a43e140d51;m=29102136a4;t=5ab0792b1dc62;x=84a1467480b8f1af | ||
realtime_timestamp: 1595423897803874 | ||
monotonic_timestamp: 176364271268 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,19 +45,14 @@ def test_start_with_journal_directory(self): | |
) | ||
journalbeat_proc = self.start_beat() | ||
|
||
required_log_snippets = [ | ||
# journalbeat can be started | ||
"journalbeat is running", | ||
# journalbeat can seek to the position defined in the cursor | ||
"Tailing the journal file", | ||
] | ||
for snippet in required_log_snippets: | ||
self.wait_until(lambda: self.log_contains(snippet), | ||
name="Line in '{}' Journalbeat log".format(snippet)) | ||
self.wait_until(lambda: self.log_contains("journalbeat is running")) | ||
|
||
exit_code = journalbeat_proc.kill_and_wait() | ||
assert exit_code == 0 | ||
|
||
# journalbeat is tailing an inactive journal | ||
assert self.output_is_empty() | ||
|
||
@unittest.skipUnless(sys.platform.startswith("linux"), "Journald only on Linux") | ||
def test_start_with_selected_journal_file(self): | ||
""" | ||
|
@@ -74,17 +69,7 @@ def test_start_with_selected_journal_file(self): | |
) | ||
journalbeat_proc = self.start_beat() | ||
|
||
required_log_snippets = [ | ||
# journalbeat can be started | ||
"journalbeat is running", | ||
# journalbeat can seek to the position defined in the cursor | ||
"Reading from the beginning of the journal file", | ||
# message can be read from test journal | ||
"\"message\": \"thinkpad_acpi: unhandled HKEY event 0x60b0\"", | ||
] | ||
for snippet in required_log_snippets: | ||
self.wait_until(lambda: self.log_contains(snippet), | ||
name="Line in '{}' Journalbeat log".format(snippet)) | ||
self.wait_until(lambda: self.output_has(lines=23)) | ||
|
||
exit_code = journalbeat_proc.kill_and_wait() | ||
assert exit_code == 0 | ||
|
@@ -106,21 +91,14 @@ def test_start_with_selected_journal_file_with_cursor_fallback(self): | |
) | ||
journalbeat_proc = self.start_beat() | ||
|
||
required_log_snippets = [ | ||
# journalbeat can be started | ||
"journalbeat is running", | ||
# journalbeat can seek to the position defined in cursor_seek_fallback. | ||
"Seeking method set to cursor, but no state is saved for reader. Starting to read from the end", | ||
# message can be read from test journal | ||
"\"message\": \"thinkpad_acpi: please report the conditions when this event happened to [email protected]\"", | ||
] | ||
for snippet in required_log_snippets: | ||
self.wait_until(lambda: self.log_contains(snippet), | ||
name="Line in '{}' Journalbeat log".format(snippet)) | ||
self.wait_until(lambda: self.log_contains("journalbeat is running")) | ||
|
||
exit_code = journalbeat_proc.kill_and_wait() | ||
assert exit_code == 0 | ||
|
||
# journalbeat is tailing an inactive journal with no cursor data | ||
assert self.output_is_empty() | ||
|
||
@unittest.skipUnless(sys.platform.startswith("linux"), "Journald only on Linux") | ||
def test_read_events_with_existing_registry(self): | ||
""" | ||
|
@@ -143,19 +121,7 @@ def test_read_events_with_existing_registry(self): | |
) | ||
journalbeat_proc = self.start_beat() | ||
|
||
required_log_snippets = [ | ||
# journalbeat can be started | ||
"journalbeat is running", | ||
# journalbeat can seek to the position defined in the cursor | ||
"Seeked to position defined in cursor", | ||
# message can be read from test journal | ||
"please report the conditions when this event happened to", | ||
# only one event is read and published | ||
'journalbeat successfully published events\t{"event.count": 1}', | ||
] | ||
for snippet in required_log_snippets: | ||
self.wait_until(lambda: self.log_contains(snippet), | ||
name="Line in '{}' Journalbeat log".format(snippet)) | ||
self.wait_until(lambda: self.output_has(lines=9)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. Once more thing: how likely is this output to not contain |
||
|
||
exit_code = journalbeat_proc.kill_and_wait() | ||
assert exit_code == 0 | ||
|
@@ -173,27 +139,13 @@ def test_read_events_with_include_matches(self): | |
], | ||
"seek": "head", | ||
"include_matches": [ | ||
"syslog.priority=5", | ||
"syslog.priority=6", | ||
] | ||
}], | ||
) | ||
journalbeat_proc = self.start_beat() | ||
|
||
required_log_snippets = [ | ||
# journalbeat can be started | ||
"journalbeat is running", | ||
# journalbeat can seek to the position defined in the cursor | ||
"Added matcher expression", | ||
# message can be read from test journal | ||
"unhandled HKEY event 0x60b0", | ||
"please report the conditions when this event happened to", | ||
"unhandled HKEY event 0x60b1", | ||
# Four events with priority 5 is publised | ||
'journalbeat successfully published events\t{"event.count": 4}', | ||
] | ||
for snippet in required_log_snippets: | ||
self.wait_until(lambda: self.log_contains(snippet), | ||
name="Line in '{}' Journalbeat log".format(snippet)) | ||
self.wait_until(lambda: self.output_has(lines=6)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
|
||
exit_code = journalbeat_proc.kill_and_wait() | ||
assert exit_code == 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed this assertion is different to any of the former ones, and besides that, the changes in other tests are asserting that the output contains
"journalbeat is running"
, is this on purpose?