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

ERROR in tearDown overwrites the test status #5801

Closed
richtja opened this issue Nov 15, 2023 · 0 comments · Fixed by #5804
Closed

ERROR in tearDown overwrites the test status #5801

richtja opened this issue Nov 15, 2023 · 0 comments · Fixed by #5804
Assignees
Labels

Comments

@richtja
Copy link
Contributor

richtja commented Nov 15, 2023

Describe the bug
When avocado job is interrupted, the test status might be overwritten is something happens during tearDown.

Steps to reproduce
test.py:

import time

from avocado import Test


class SleepTest(Test):

    """
    This test sleeps for 1s by default

    :param sleep_length: Sleep duration
    """

    def test(self):
        """
        Sleep for length seconds.
        """
        sleep_length = float(self.params.get("sleep_length", default=5))
        self.log.debug("Sleeping for %.2f seconds", sleep_length)
        time.sleep(sleep_length)

    def tearDown(self):
        self.error("tearDown ERROR")

command:

avocado run --job-timeout=3 test.py

Expected behavior
A clear and concise description of what you expected to happen.

JOB ID     : 859fda4217b6609f5b3c5066d808f58460ed2b23
JOB LOG    : /home/janrichter/avocado/job-results/job-2023-11-15T15.50-859fda4/job.log
 (1/1) /tmp/test.py:SleepTest.test: STARTED
 (1/1) /tmp/test.py:SleepTest.test: INTERRUPTED: Test interrupted: Timeout reached (2.72 s)

RESULTS    : PASS 0 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 1 | CANCEL 0
JOB HTML   : /home/janrichter/avocado/job-results/job-2023-11-15T15.50-859fda4/results.html
JOB TIME   : 3.82 s

Current behavior

JOB ID     : 6e89e37a5c82c933a8ca07be79b9998681da5224
JOB LOG    : /home/janrichter/avocado/job-results/job-2023-11-15T15.46-6e89e37/job.log
 (1/1) /tmp/test.py:SleepTest.test: STARTED
 (1/1) /tmp/test.py:SleepTest.test: ERROR: tearDown ERROR (2.72 s)

RESULTS    : PASS 0 | ERROR 1 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /home/janrichter/avocado/job-results/job-2023-11-15T15.46-6e89e37/results.html
JOB TIME   : 3.96 s

@richtja richtja added the bug label Nov 15, 2023
@richtja richtja self-assigned this Nov 15, 2023
@mr-avocado mr-avocado bot moved this to Triage in Default project Nov 15, 2023
@richtja richtja moved this from Triage to In progress in Default project Nov 15, 2023
richtja added a commit to richtja/avocado that referenced this issue Nov 16, 2023
When avocado-instrumented test is interrupted, the avocado runner will
call a tearDown method to clean the test environment. If some error is
raised during the tearDown phase, the `INTERRUPTED` status is
overwritten by this error. This is not desired behavior, because the
reason for the error was interruption of the test. This fix keeps
logging of the tearDown error without change of the `INTERRUPTED`
status.

Reference: avocado-framework#5801
Signed-off-by: Jan Richter <jarichte@redhat.com>
@richtja richtja linked a pull request Nov 16, 2023 that will close this issue
richtja added a commit to richtja/avocado that referenced this issue Nov 20, 2023
When avocado-instrumented test is interrupted, the avocado runner will
call a tearDown method to clean the test environment. If some error is
raised during the tearDown phase, the `INTERRUPTED` status is
overwritten by this error. This is not desired behavior, because the
reason for the error was interruption of the test. This fix keeps
logging of the tearDown error without change of the `INTERRUPTED`
status.

Reference: avocado-framework#5801
Signed-off-by: Jan Richter <jarichte@redhat.com>
richtja added a commit to richtja/avocado that referenced this issue Nov 24, 2023
When avocado-instrumented test is interrupted, the avocado runner will
call a tearDown method to clean the test environment. If some error is
raised during the tearDown phase, the `INTERRUPTED` status is
overwritten by this error. This is not desired behavior, because the
reason for the error was interruption of the test. This fix keeps
logging of the tearDown error without change of the `INTERRUPTED`
status.

Reference: avocado-framework#5801
Signed-off-by: Jan Richter <jarichte@redhat.com>
richtja added a commit to richtja/avocado that referenced this issue Nov 27, 2023
When avocado-instrumented test is interrupted, the avocado runner will
call a tearDown method to clean the test environment. If some error is
raised during the tearDown phase, the `INTERRUPTED` status is
overwritten by this error. This is not desired behavior, because the
reason for the error was interruption of the test. This fix keeps
logging of the tearDown error without change of the `INTERRUPTED`
status.

Reference: avocado-framework#5801
Signed-off-by: Jan Richter <jarichte@redhat.com>
@github-project-automation github-project-automation bot moved this from In progress to Done 103 in Default project Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant