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

fix unstable gelf test #1180

Merged
merged 2 commits into from
May 18, 2023
Merged
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
11 changes: 4 additions & 7 deletions tests/gelf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,11 @@ def gelfServer(stop):
# find the stderr log file
stderr_file = glob.glob(os.path.join(data_dir, 'stderr.*.txt'))
with open(stderr_file[0], "r") as f:
stderr_lines = f.readlines()
stderr_txt = f.read().rstrip()

#Less one line because the GELF appender does not transmit 'opened GELF socket to endpoint...
assert len(stderr_lines)-1 == len(received_logs), "number of log entry received from GELF does not match stderr"

stderr_lines.pop(0)
for (stderr_line, received_log) in zip(stderr_lines, received_logs):
assert received_log in stderr_line, "received GELF log entry does not match that of from stderr"
assert len(received_logs) > 10, "Not enough gelf logs are received"
for received_log in received_logs:
assert received_log in stderr_txt, "received GELF log entry does not match that of stderr"

if os.path.exists(Utils.DataPath):
shutil.rmtree(Utils.DataPath)