fix(test): Retry flaky test

test_update_document test randomly breaks in Postgres CI. The remedy right now is to re-run the builds until the success checks come up. This change retries the specific test 2 more times before failing the build
This commit is contained in:
Gavin D'souza 2021-06-09 13:09:24 +05:30
parent 8b85ac6cf4
commit 7a30b2455e
2 changed files with 3 additions and 0 deletions

View file

@ -3,6 +3,7 @@ from random import choice
import requests
from semantic_version import Version
from tenacity import retry, stop_after_attempt, retry_if_exception_type, wait_fixed
import frappe
from frappe.utils import get_site_url
@ -124,6 +125,7 @@ class TestResourceAPI(unittest.TestCase):
self.assertIsInstance(docname, str)
self.GENERATED_DOCUMENTS.append(docname)
@retry(stop=stop_after_attempt(2) | retry_if_exception_type(AssertionError), wait=wait_fixed(3))
def test_update_document(self):
# test 8: PUT method on /api/resource to update doc
generated_desc = frappe.mock("paragraph")

View file

@ -68,6 +68,7 @@ simple-chalk~=0.1.0
six~=1.15.0
sqlparse~=0.4.1
stripe~=2.56.0
tenacity~=7.0.0
terminaltables~=3.1.0
unittest-xml-reporting~=3.0.4
urllib3~=1.26.4