Skip to content

Data Access - test-suite.sh doesn't work for "http" scheme, "https" hardcoded in a python script in the docker container #118

@blaziq

Description

@blaziq

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?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions