Mangopay / mangopay2-python-sdk

SDK Python for MANGOPAY
https://pypi.org/project/mangopaysdk/
MIT License
33 stars 43 forks source link

Flaky test: test_GetKycDocuments #326

Open lmonari opened 1 year ago

lmonari commented 1 year ago

Hi everyone

Recently, we noticed that the test test_GetKycDocuments started failing sometimes. Here are a couple of logs from different test runs:

Run 1

======================================================================
ERROR: test_GetKycDocuments (tests.test_kyc_document.KYCDocumentTestLive)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/tests/test_kyc_document.py", line 12, in test_GetKycDocuments
    result = Document.all(page=1, per_page=2, Sort='CreationDate:ASC')
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/base.py", line 264, in all
    return cls.select().all(*args, **kwargs)
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/query.py", line 85, in all
    result, data = handler.request(self.method, url, without_client_id=without_client_id, **params)
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/api.py", line 64, in request
    return self.custom_request(method, url, data, idempotency_key, oauth_request, True, without_client_id, **params)
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/api.py", line [16](https://github.com/plentific/mangopay2-python-sdk/actions/runs/3939465490/jobs/6739356435#step:5:17)1, in custom_request
    self._create_apierror(result, url=url, data=truncated_data, method=method)
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/api.py", line 253, in _create_apierror
    raise APIError(text, code=status_code, content=content, headers=headers)
mangopay.exceptions.APIError: {"Message":"Internal Server Error","Type":"other","Id":"1d886124-4542-4f42-b287-0b5e01ad2d90#1673960406","Date":1673960412.0,"errors":null}

Run 2

======================================================================
ERROR: test_GetKycDocuments (tests.test_kyc_document.KYCDocumentTestLive)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/tests/test_kyc_document.py", line 16, in test_GetKycDocuments
    result2 = Document.all(page=1, per_page=2, Sort='CreationDate:DESC')
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/base.py", line 264, in all
    return cls.select().all(*args, **kwargs)
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/query.py", line 85, in all
    result, data = handler.request(self.method, url, without_client_id=without_client_id, **params)
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/api.py", line 64, in request
    return self.custom_request(method, url, data, idempotency_key, oauth_request, True, without_client_id, **params)
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/api.py", line 161, in custom_request
    self._create_apierror(result, url=url, data=truncated_data, method=method)
  File "/home/runner/work/mangopay2-python-sdk/mangopay2-python-sdk/mangopay/api.py", line 253, in _create_apierror
    raise APIError(text, code=status_code, content=content, headers=headers)
mangopay.exceptions.APIError: {"Message":"Internal Server Error","Type":"other","Id":"62776014-c2dd-4feb-962d-4e3e837fd118#1674660821","Date":1674660827.0,"errors":null}

As you can see, it fails (sometimes) when calling Document.all(...):

lmonari commented 1 year ago

A more detailed output of the failed test (branch: master) test_GetKycDocuments_error_logs.txt