Skip to content

Commit cd07b36

Browse files
committed
fix: use the proper status and do check job status after data download
1 parent 1fdf39e commit cd07b36

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

tests/integration_tests/test_full_cycle.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ def check_job_till_finish(auth_harvester, operandi, workflow_job_id: str):
2121
response = operandi.get(url=check_job_status_url, auth=auth_harvester)
2222
assert_response_status_code(response.status_code, expected_floor=2)
2323
job_status = response.json()["job_state"]
24-
if job_status == StateJob.SUCCESS:
24+
if job_status == StateJob.HPC_SUCCESS:
2525
break
26+
if job_status == StateJob.HPC_FAILED:
27+
break
28+
assert job_status == StateJob.HPC_SUCCESS
2629

27-
# TODO: Fix may be needed here
28-
# When failed loop 5 more times.
29-
# Sometimes the FAILED changes to SUCCESS
30-
if job_status == StateJob.FAILED and tries > 5:
31-
tries = 5
30+
def check_job_status_after_data_download(auth_harvester, operandi, workflow_job_id: str):
31+
check_job_status_url = f"/workflow-job/{workflow_job_id}"
32+
response = operandi.get(url=check_job_status_url, auth=auth_harvester)
33+
assert_response_status_code(response.status_code, expected_floor=2)
34+
job_status = response.json()["job_state"]
3235
assert job_status == StateJob.SUCCESS
3336

34-
3537
def download_workflow_job_logs(auth_harvester, operandi, workflow_job_id: str):
3638
tries = 60
3739
get_log_zip_url = f"/workflow-job/{workflow_job_id}/logs"
@@ -112,3 +114,5 @@ def test_full_cycle(auth_harvester, operandi, service_broker, bytes_small_worksp
112114
assert Path(wf_job_dir, "work").exists
113115
assert Path(wf_job_dir, workspace_id, input_file_grp).exists()
114116
assert Path(wf_job_dir, workspace_id, "OCR-D-OCR").exists()
117+
118+
check_job_status_after_data_download(auth_harvester, operandi, workflow_job_id)

0 commit comments

Comments
 (0)