behave_tests: fix infinite recursion 90/73390/1
authorGwenael Lambrouin <gwenael.lambrouin@orange.com>
Wed, 18 May 2022 12:54:20 +0000 (12:54 +0000)
committerGwenael Lambrouin <gwenael.lambrouin@orange.com>
Tue, 31 May 2022 07:41:34 +0000 (09:41 +0200)
Fix bug in behave_tests that occurs when behave looks for a previous
result (either non-regression or characterization) in testapi database.

When the result cannot be found on the first results page, behave enters
an infinite recursion.  Eventually, the operating system kills the
python interpreter leading to a return code equal to 137.

When behave is run by xtesting run_tests command, run_tests is also
killed so the error is not reported by xtesting.

This is now fixed.

Signed-off-by: Gwenael Lambrouin <gwenael.lambrouin@orange.com>
Change-Id: I6b0feafb5ebadf7d0d1df6d0ee03fd22cbe6899d

behave_tests/features/steps/steps.py

index cfb5848..512a4e5 100644 (file)
@@ -623,5 +623,5 @@ def get_last_result(context, reference=None, page=None):
                 return tagged_result
     if last_results["pagination"]["current_page"] < last_results["pagination"]["total_pages"]:
         page = last_results["pagination"]["current_page"] + 1
-        return get_last_result(context, page)
+        return get_last_result(context, reference, page)
     return None