Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for ocrd-network #1184

Merged
merged 27 commits into from
May 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
eb0da74
Add a test for workflow run in ocrd_all
joschrew Feb 7, 2024
79c5b79
remove duplicates
MehmedGIT Feb 12, 2024
3d501b5
Make make assets in Dockerfile skipable
joschrew Feb 12, 2024
7f77b57
Add a test for workflow run in ocrd_all
joschrew Mar 13, 2024
9cdb222
remove duplicates
MehmedGIT Feb 12, 2024
419a535
Make make assets in Dockerfile skipable
joschrew Mar 13, 2024
a55d961
Merge branch 'test-workflow' of github.com:OCR-D/core into test-workflow
MehmedGIT Apr 11, 2024
cb8cde7
merge master
MehmedGIT Apr 11, 2024
dfd78d5
make ocrd all tests callable from Makefile
MehmedGIT Apr 11, 2024
14576cf
update actions and add python 3.12
Apr 10, 2024
34459e0
update actions and add python 3.12
Apr 10, 2024
7d119aa
update actions
Apr 10, 2024
2a7ef7b
Remove ocrd_all-tests from core makefile
joschrew Apr 16, 2024
3effd63
ci: disable scrutinizer build
kba Apr 16, 2024
8dae53d
bashlib input-files: apply download_file on each input_file
bertsky Apr 25, 2024
0195099
bashlib input-files: let None pass through
bertsky Apr 25, 2024
feee374
scrutinizer: try to fix py version
bertsky Apr 25, 2024
48d52e3
:memo: changelog
kba May 3, 2024
71ec3a2
Merge branch 'master' into update/workflows
kba May 3, 2024
c8f41a5
drop distutils, support python 3.12
kba May 3, 2024
b788b59
:memo: changelog
kba May 3, 2024
df77ace
Merge branch 'master' into update/workflows
kba May 3, 2024
cf4664a
disable ocrd all test in core
MehmedGIT May 3, 2024
e88d646
:memo: changelog
kba May 3, 2024
6ecbaa8
make network-integration-test: disable ocrd_all test
kba May 3, 2024
f714742
Merge branch 'master' into test-workflow
kba May 3, 2024
1bd8fc4
ci: fix integration test
kba May 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions tests/network/test_ocrd_all_workflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from time import sleep
from requests import get, post
from src.ocrd_network.models import StateEnum
from tests.base import assets
from tests.network.config import test_config

PROCESSING_SERVER_URL = test_config.PROCESSING_SERVER_URL


def poll_till_timeout_fail_or_success(test_url: str, tries: int, wait: int) -> StateEnum:
job_state = StateEnum.unset
while tries > 0:
sleep(wait)
response = get(url=test_url)
assert response.status_code == 200, f"Processing server: {test_url}, {response.status_code}"
job_state = response.json()["state"]
if job_state == StateEnum.success or job_state == StateEnum.failed:
break
tries -= 1
return job_state


def test_ocrd_all_workflow():
# This tests is supposed to with ocrd_all not with just core on its own
# Note: the used workflow path is volume mapped
path_to_wf = "/ocrd-data/assets/ocrd_all-test-workflow.txt"
kba marked this conversation as resolved.
Show resolved Hide resolved
path_to_mets = "/data/mets.xml"

# submit the workflow job
test_url = f"{PROCESSING_SERVER_URL}/workflow/run?mets_path={path_to_mets}&page_wise=True"
response = post(
url=test_url,
headers={"accept": "application/json"},
files={"workflow": open(path_to_wf, 'rb')}
)
# print(response.json())
assert response.status_code == 200, (
f"Processing server: {test_url}, {response.status_code}. "
f"Response text: {response.text}"
)
wf_job_id = response.json()["job_id"]
assert wf_job_id

job_state = poll_till_timeout_fail_or_success(
test_url=f"{PROCESSING_SERVER_URL}/workflow/job-simple/{wf_job_id}",
tries=30,
wait=10
)
assert job_state == StateEnum.success
Loading