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: missing logs on pytest failures #3255

Open
adiholden opened this issue Jul 2, 2024 · 0 comments
Open

fix: missing logs on pytest failures #3255

adiholden opened this issue Jul 2, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@adiholden
Copy link
Collaborator

Today we save the instance log path to a file after starting instance
` self.log_files = self.get_logs_from_psutil()

    last_log_file = open("/tmp/last_test_log_files.txt", "a")

    for log in self.log_files:
        last_log_file.write(log + "\n")`

after that we check if test failed and if so copy the log files /tmp/failed
in function copy_failed_logs_and_clean_tmp_folder

The problem:

  1. copy_failed_logs_and_clean_tmp_folder runs before we shutdown the server which is why we have some log lines missing if test fails
  2. we have log files only if instance started successfuly

We want to fix the logic by:

  1. use --log_dir flag for each test this way we will know where we will store the log files and will not need to use get_logs_from_psutil
  2. check if the test failed copy the log files only after instance.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants