diff --git a/osbs/tekton.py b/osbs/tekton.py index 593fd7f6..56a85776 100644 --- a/osbs/tekton.py +++ b/osbs/tekton.py @@ -600,15 +600,8 @@ def get_final_platforms(self): return None if 'platforms_result' in task_results['binary-container-prebuild']: - raw_result = task_results['binary-container-prebuild']['platforms_result'] - - try: - value = json.loads(raw_result) - # TypeError is returned when value is list - except (json.JSONDecodeError, TypeError): - value = raw_result - - return value + platforms = json.loads(task_results['binary-container-prebuild']['platforms_result']) + return platforms['platforms'] return None diff --git a/tests/test_api.py b/tests/test_api.py index 74db7aa6..95849bd7 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1056,8 +1056,7 @@ def test_get_build_error_message(self, osbs_binary): assert error_msg == osbs_binary.get_build_error_message('run_name') @pytest.mark.parametrize('platforms_result', [ - '["x86_64", "ppc64le"]', - ["x86_64", "ppc64le"], + '{"platforms": ["x86_64", "ppc64le"]}', ]) def test_get_final_platforms(self, osbs_binary, platforms_result): taskruns = {'task1': {'status': {'conditions': [{'reason': 'Succeeded'}], diff --git a/tests/test_tekton.py b/tests/test_tekton.py index e0a09492..21c9ccff 100644 --- a/tests/test_tekton.py +++ b/tests/test_tekton.py @@ -894,7 +894,7 @@ def test_get_error_message(self, pipeline_run, get_json, error_lines): 'status': {'startTime': '2022-04-26T15:58:42Z', 'conditions': [{'reason': 'Succeeded'}], 'taskResults': [{'name': 'platforms_result', - 'value': []}]}, + 'value': '{"platforms": []}'}]}, } }}}, []), @@ -907,7 +907,8 @@ def test_get_error_message(self, pipeline_run, get_json, error_lines): 'status': {'startTime': '2022-04-26T15:58:42Z', 'conditions': [{'reason': 'Succeeded'}], 'taskResults': [{'name': 'platforms_result', - 'value': ["x86_64", "ppc64le"]}]}, + 'value': '{"platforms": ' + '["x86_64", "ppc64le"]}'}]}, } }}}, ["x86_64", "ppc64le"]),