From de1de8b82063297d5418e919263f423dad980dbc Mon Sep 17 00:00:00 2001 From: RamosFe Date: Fri, 27 Oct 2023 16:52:23 -0300 Subject: [PATCH] Changes logic for xfail test in test_api performance test. --- .../test_api/test_api_endpoints_performance.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/performance/test_api/test_api_endpoints_performance.py b/tests/performance/test_api/test_api_endpoints_performance.py index eef8a84c16..30efb52caf 100755 --- a/tests/performance/test_api/test_api_endpoints_performance.py +++ b/tests/performance/test_api/test_api_endpoints_performance.py @@ -50,9 +50,14 @@ def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck): finally: # Add useful information to report as stdout try: - print(f'Request elapsed time: {response.elapsed.total_seconds():.3f}s\n') - print(f'Status code: {response.status_code}\n') - print(f'Full response: \n{dumps(response.json(), indent=2)}') + # If the test failed and it was expected as xfail, mark it + if test_case['endpoint'] in xfailed_items.keys() and \ + test_case['method'] == xfailed_items[test_case['endpoint']]['method']: + pytest.xfail(xfailed_items[test_case['endpoint']]['message']) + else: + print(f'Request elapsed time: {response.elapsed.total_seconds():.3f}s\n') + print(f'Status code: {response.status_code}\n') + print(f'Full response: \n{dumps(response.json(), indent=2)}') except KeyError: print('No response available')