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

Makefile-test for ocrd-network #407

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
[submodule "cor-asv-ann"]
path = cor-asv-ann
url = https://github.com/ASVLeipzig/cor-asv-ann.git
[submodule "tesseract"]
path = tesseract
url = https://github.com/tesseract-ocr/tesseract.git
[submodule "format-converters"]
path = format-converters
url = https://github.com/OCR-D/format-converters.git
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,19 @@ testcuda test-cuda: $(ACTIVATE_VENV)
test-workflow: test-assets core $(BIN)/ocrd $(ACTIVATE_VENV)
. $(ACTIVATE_VENV) && cd core/tests/assets/SBB0000F29300010000/data/ && bash -x $(CURDIR)/test-workflow.sh

DOCKER_COMPOSE = docker compose
INTEGRATION_TEST_IN_DOCKER = docker exec core_test

integration-test: test-assets
$(DOCKER_COMPOSE) --file core/tests/network/docker-compose.yml --file tests/network/docker-compose.yml up -d
docker cp core/tests/assets/kant_aufklaerung_1784/data/. ocrd_network_processing_server:/data
# Queues must exists and it takes time until they are created by the workers. We might need
# a mechanism to test if all queues are there but that is not available yet. So sleeping
# here for now
sleep 10
-$(INTEGRATION_TEST_IN_DOCKER) pytest -k 'test_ocrd_all_workflow' -v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-$(INTEGRATION_TEST_IN_DOCKER) pytest -k 'test_ocrd_all_workflow' -v
$(INTEGRATION_TEST_IN_DOCKER) pytest -k 'test_ocrd_all_workflow' -v

We want failure of the test command in failure of the make integration-test target, no?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the CI/CD pipeline, yes. However, when testing locally, failed tests leave leftovers. Potentially, we need both versions?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for that use-case we used to have the convention of passing a variable PYTEST_ARGS where the user could insert things like --continue-on-collection-errors, right?

$(DOCKER_COMPOSE) --file core/tests/network/docker-compose.yml --file tests/network/docker-compose.yml down -v --remove-orphans

test-assets:
$(MAKE) -C core assets

Expand Down
181 changes: 181 additions & 0 deletions tests/network/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
services:
ocrd_network_processing_server:
image: processing-server
build:
context: ../../../core
joschrew marked this conversation as resolved.
Show resolved Hide resolved
target: ocrd_core_base

ocrd_network_core_test:
build:
context: ../../../core
args:
SKIP_ASSETS: 1

ocrd-olena-binarize:
build:
context: ../../../ocrd_olena
container_name: ocrd-olena-binarize
joschrew marked this conversation as resolved.
Show resolved Hide resolved
depends_on:
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-olena-binarize worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}


ocrd-anybaseocr-crop:
build:
context: ../../../ocrd_anybaseocr
container_name: ocrd-anybaseocr-crop
depends_on:
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-anybaseocr-crop worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}


ocrd-cis-ocropy-denoise:
build:
context: ../../../ocrd_cis
container_name: ocrd-cis-ocropy-denoise
joschrew marked this conversation as resolved.
Show resolved Hide resolved
depends_on:
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-cis-ocropy-denoise worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}


ocrd-cis-ocropy-clip:
build:
context: ../../../ocrd_cis
container_name: ocrd-cis-ocropy-clip
joschrew marked this conversation as resolved.
Show resolved Hide resolved
depends_on:
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-cis-ocropy-clip worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}


ocrd-cis-ocropy-segment:
build:
context: ../../../ocrd_cis
depends_on:
joschrew marked this conversation as resolved.
Show resolved Hide resolved
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-cis-ocropy-segment worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}


ocrd-cis-ocropy-dewarp:
build:
context: ../../../ocrd_cis
container_name: ocrd-cis-ocropy-dewarp
joschrew marked this conversation as resolved.
Show resolved Hide resolved
depends_on:
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-cis-ocropy-dewarp worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}


ocrd-tesserocr-segment-region:
image: ocrd/tesserocr
container_name: ocrd-tesserocr-segment-region
depends_on:
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- TESSDATA_PREFIX=/usr/local/share/tessdata
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-tesserocr-segment-region worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}


ocrd-tesserocr-recognize:
image: ocrd/tesserocr
container_name: ocrd-tesserocr-recognize
depends_on:
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- TESSDATA_PREFIX=/usr/local/share/tessdata
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-tesserocr-recognize worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}


ocrd-segment-repair:
image: ocrd/segment
container_name: ocrd-segment-repair
depends_on:
ocrd_network_processing_server:
condition: service_healthy
networks:
- ${DOCKER_OCRD_NETWORK_NAME}
environment:
- OCRD_NETWORK_LOGS_ROOT_DIR=/ocrd-data/ocrd_network_logs
- OCRD_LOGGING_DEBUG=true
volumes:
- ${OCRD_NETWORK_LOGS_ROOT}:/ocrd-data/ocrd_network_logs
- ${OCRD_NETWORK_SOCKETS_ROOT}:/ocrd-data/ocrd_network_sockets
- ${OCRD_NETWORK_DATA}:/data
command: ocrd-segment-repair worker --database ${MONGODB_URL} --queue ${RABBITMQ_URL}