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

libvirt-guests: Improve test logging #5173

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

smitterl
Copy link
Contributor

The test sometimes fails and there's no log for the guest service at all. Add checks for start and restart to succeed and if not, log the service logs with journalctl.

Also, the Tail was called incorrectly leading to (per default unrecorded) TypeError

"can only concatenate str (not "tuple") to str"

The Tail already has a log file where it stores the output. Print its path so it can be inspected if needed.

The test sometimes fails and there's no log for the guest service at
all. Add checks for start and restart to succeed and if not, log
the service logs with journalctl.

Also, the Tail was called incorrectly leading to (per default unrecorded) TypeError

"can only concatenate str (not "tuple") to str"

The Tail already has a log file where it stores the output. Print its
path so it can be inspected if needed.

Signed-off-by: Sebastian Mitterle <[email protected]>
@smitterl
Copy link
Contributor Author

JOB ID     : c45442dfd43e1bf466fb1587412bf8bdf2d9bc15
JOB LOG    : /var/lib/avocado/job-results/job-2023-09-12T07.15-c45442d/job.log
 (1/7) type_specific.io-github-autotest-libvirt.managedsave.libvirt_guests.positive_test.no_parallel_shutdown.suspend_on_shutdown.default_vol.start_on_boot: PASS (47.56 s)
 (2/7) type_specific.io-github-autotest-libvirt.managedsave.libvirt_guests.positive_test.no_parallel_shutdown.suspend_on_shutdown.default_vol.ignore_on_boot: PASS (45.24 s)
 (3/7) type_specific.io-github-autotest-libvirt.managedsave.libvirt_guests.positive_test.no_parallel_shutdown.suspend_on_shutdown.nfs_vol.start_on_boot: PASS (53.20 s)
 (4/7) type_specific.io-github-autotest-libvirt.managedsave.libvirt_guests.positive_test.no_parallel_shutdown.shutdown_on_shutdown.start_on_boot: PASS (51.52 s)
 (5/7) type_specific.io-github-autotest-libvirt.managedsave.libvirt_guests.positive_test.no_parallel_shutdown.shutdown_on_shutdown.ignore_on_boot: PASS (46.71 s)
 (6/7) type_specific.io-github-autotest-libvirt.managedsave.libvirt_guests.positive_test.parallel_shutdown.shutdown_on_shutdown.start_on_boot: PASS (75.65 s)
 (7/7) type_specific.io-github-autotest-libvirt.managedsave.libvirt_guests.negative_test.no_parallel_shutdown: PASS (52.46 s)
RESULTS    : PASS 7 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /var/lib/avocado/job-results/job-2023-09-12T07.15-c45442d/results.html
JOB TIME   : 372.89 s

Copy link
Contributor

@cliping cliping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

output_params=(tailed_log_file))
tailed_messages = aexpect.Tail(command='tail -f /var/log/messages')
logging.debug("Tail of log messages are logged in %s",
tailed_messages.output_filename)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this output_filename be cleaned after testing automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not by default. The file is test specific and created under the tmp basedir https://github.com/avocado-framework/aexpect/blob/main/aexpect/client.py#L145

The way to clean those files would be to call tailed_messages explicitly. We don't do this so we can inspect the file after the test run.

@dzhengfy dzhengfy merged commit dff5fd1 into autotest:master Nov 16, 2023
4 checks passed
@smitterl smitterl deleted the improve_guests branch November 20, 2023 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants