Commit 8e5edc5b authored by Jérome Perrin's avatar Jérome Perrin

test_result: Tolerate API errors when marking a test running

Sometimes these API fail, but that's not so important, what matters is marking commits as success or failure at the end of test.
parent 2143a49b
Pipeline #8397 failed with stage
in 0 seconds
...@@ -102,6 +102,13 @@ class GitlabRESTConnector(XMLObject): ...@@ -102,6 +102,13 @@ class GitlabRESTConnector(XMLObject):
# branch. This typically happen after a new commit was push-forced to # branch. This typically happen after a new commit was push-forced to
# the tested branch. # the tested branch.
return return
if state == 'running' and response.status_code == requests.codes.bad_request:
# Since we updated to gitlab 9.5.10, sometimes annotating a test as running
# fail with "Cannot transition status via :run from :running" error. This
# seem to happen when previous test did not receive the finish notification.
# In that case, it's better to ignore the error, the commit will not be
# annotated as "running", but that seems acceptable.
return
response.raise_for_status() response.raise_for_status()
......
...@@ -1720,3 +1720,13 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase): ...@@ -1720,3 +1720,13 @@ class TestGitlabRESTConnectorInterface(ERP5TypeTestCase):
self.test_result.start() self.test_result.start()
self.tic() self.tic()
def test_start_test_tolerate_errors(self):
with responses.RequestsMock() as rsps:
rsps.add(
responses.POST,
self.post_commit_status_url,
json={"message": 'Cannot transition status via :run from :running (Reason(s): Status cannot transition via "run")'},
status=httplib.BAD_REQUEST,
)
self.test_result.start()
self.tic()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment