ElliottKasoar / abcd

0 stars 0 forks source link

Add unit testing for OpenSearch #8

Closed ElliottKasoar closed 7 months ago

ElliottKasoar commented 1 year ago

Some unit tests are already written via openmock, but more may be possible for newer functionality e.g. adding/renaming properties.

However, the mocked functionality provided by openmock is limited, so more complete testing through a temporary live database (e.g. spun up through GitHub Actions), or using a self-hosted runner, may be preferable.

See opensearch-py for examples, which roughly does the following:

  1. .github/workflows/integration.yml - controls testing environment
  2. .ci/run-tests - sets additional environment variables
  3. .ci/run-opensearch.sh - launches OpenSearch nodes via Docker images
  4. .ci/run-repository.sh - build client container via Docker image
  5. setup.py - install test requirements
  6. test_opensearchpy/run_tests.py - run unit tests
ElliottKasoar commented 1 year ago

Largely implemented, based both on opensearch-py and Elastic's GitHub Actions.

Occasional issues remain with connection issues, as sometimes the container fails to start in time.

Further tests, both in terms of ABCD functionality and OpenSearch docker settings, could be implemented. See also: #11