In the Data Access Building Block there is this Test Suite execution step meant for validation of the deployment. It's a script that pulls the docker container eoepca/system-test and runs pytest from the container (with options):
Run the Data Access tests from the system test suite.
../../test-suite.sh test/data-access
However, if the scheme chosen in the configuration is http, it does not work, because the https prefix is hardcoded in the file test/data-access/conftest.py inside the container. Plus, in our very specific configuration (no proper DNS, domain names hardcoded in /etc/hosts instead) it is unable to resolve the Data Access services endpoints http://eoapi.eoepca.local/stac, http://eoapi.eoepca.local/raster etc.
I have managed to actually run the Test Suite by changding the test-suite.sh as follows:
docker run --rm -t -u $UID:$GID \
--network=host \
-e target=eoepca \
-v ~/.eoepca/pytest.env:/work/test/.env.eoepca \
-v ${ORIG_DIR}/.pytest_cache:/work/.pytest_cache \
-v ${ORIG_DIR}:/work/out \
eoepca/system-test \
bash -c "sed -i -e \"s/https/${HTTP_SCHEME}/g\" test/data-access/conftest.py && pytest test ${PYTEST_OPTIONS} -v --junit-xml=out/test-report.xml"
Changes in bold:
--network-host to allow host resolution from /etc/hosts on the host
sed ... to replace the hardcoded https with the actual scheme
It does work, however, I realize it is a very dirty hack and not something that should ever find its way to a proper release.
Please update the docker image eoepca/system-test as well as the test-suite.sh script to recognize the actual HTTP scheme that was chosen during BB configuration and also add an option to pass --network=host to the call.
Also, does this Test Suite actually do anything more than checking for the availability of the services' endpoints?
In the Data Access Building Block there is this Test Suite execution step meant for validation of the deployment. It's a script that pulls the docker container
eoepca/system-testand runspytestfrom the container (with options):However, if the scheme chosen in the configuration is
http, it does not work, because thehttpsprefix is hardcoded in the filetest/data-access/conftest.pyinside the container. Plus, in our very specific configuration (no proper DNS, domain names hardcoded in/etc/hostsinstead) it is unable to resolve the Data Access services endpointshttp://eoapi.eoepca.local/stac,http://eoapi.eoepca.local/rasteretc.I have managed to actually run the Test Suite by changding the
test-suite.shas follows:docker run --rm -t -u $UID:$GID \ --network=host \ -e target=eoepca \ -v ~/.eoepca/pytest.env:/work/test/.env.eoepca \ -v ${ORIG_DIR}/.pytest_cache:/work/.pytest_cache \ -v ${ORIG_DIR}:/work/out \ eoepca/system-test \ bash -c "sed -i -e \"s/https/${HTTP_SCHEME}/g\" test/data-access/conftest.py && pytest test ${PYTEST_OPTIONS} -v --junit-xml=out/test-report.xml"Changes in bold:
--network-hostto allow host resolution from/etc/hostson the hostsed ...to replace the hardcodedhttpswith the actual schemeIt does work, however, I realize it is a very dirty hack and not something that should ever find its way to a proper release.
Please update the docker image
eoepca/system-testas well as thetest-suite.shscript to recognize the actual HTTP scheme that was chosen during BB configuration and also add an option to pass--network=hostto the call.Also, does this Test Suite actually do anything more than checking for the availability of the services' endpoints?