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

Infinite loop of retries for RetryFailed listener #11

Open
olegosh opened this issue Oct 23, 2024 · 1 comment
Open

Infinite loop of retries for RetryFailed listener #11

olegosh opened this issue Oct 23, 2024 · 1 comment

Comments

@olegosh
Copy link

olegosh commented Oct 23, 2024

I have a test run set up in GCP where in options I included RetryFailed listener and skips for tags "skip":

substitutions
...
_ROBOT_OPTIONS: --listener RetryFailed --exclude skip
_HEADLESS: 'True'
...

Inside the test case I use tag:

[Tags]    test:retry(1)

I faced an issue that test run is stuck in an infinite loop. In the logs I can see messages:

retry_loop

...and again, and again: PASS skip FAIL skip. And it retries like this for hours until the job stops by timeout. I have a scheduled run.

I ran the same exact configuration tests run in Docker container locally and RetryFailed listener works as expected, without this infinite loop of retries.

I don't know if anyone stumbled upon this issue, but I found no similar information as to why it might happen.

I'm not sure, but I think the issue might happen because of the thing that in this block of code it sets up the result.status = "SKIP", sets the retry count back to 0, and on the next retry, which shouldn't happen, it loops back again:

def end_test(self, test, result):
        if self.retries and self._original_log_level is not None:
            BuiltIn()._context.output.set_log_level(self._original_log_level)
        if not self.max_retries:
            self.retries = 0
            return
        if result.status == "FAIL":
            if self.retries < self.max_retries:
                index = test.parent.tests.index(test)
                test.parent.tests.insert(index + 1, test)
                result.status = "SKIP"
                result.message += "\nSkipped for Retry"
                self.retried_tests.append(test.longname)
                self.retries += 1
                return
            else:
                result.message += (
                    f"{linebreak * bool(result.message)}[RETRY] FAIL on {self.retries}. retry."
                )
        else:
            if self.retries:
                result.message += (
                    f"{linebreak * bool(result.message)}[RETRY] PASS on {self.retries}. retry."
                )
        self.retries = 0
        return

The expected behavior is that it should mark test as FAIL after defined number of retries, and then skip to the next test run

@zawazingo
Copy link

Hi,
I'm encountering the same problem where our Jenkins pipeline experiences prolonged delays whenever a test fails during execution.
Any assistance you can provide would be greatly appreciated.

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

No branches or pull requests

2 participants