Newer
Older
There are two types of tests: "testinfra" tests, and "behave" tests.
- Testinfra tests are split into two groups, lets call them blackbox- and
whitebox tests. The blackbox tests run on your laptop and test the OAS
cluster from the outside. For example, the certificate check will check if the
OAS will return valid certificates for the provided services. The whitebox
tests run on the OAS host and check i.e. if docker is installed in the right
version etc.
- Behave tests run in a browser and test if all the interfaces are up and
running and correctly connected to each other.
Export `CLUSTER_DIR` env var with the location of your cluster config directory:
export CLUSTER_DIR="../clusters/CLUSTERNAME"
py.test -sv --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*'
py.test -sv --hosts='ssh://root@example.openappstack.net'
Run only tests tagged with `prometheus`:
py.test -sv --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*' -m prometheus
Run cert test manually using the ansible inventory file:
py.test -sv --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*' -m certs
Run cert test manually against a different cluster, not configured in any
ansible inventory file, either by using pytest:
FQDN='example.openappstack.net' py.test -sv -m 'certs'
FQDN='example.openappstack.net' pytest/test_certs.py
## Run *behave* tests
The behave tests are controlled by the `openappstack` CLI command suite. To run
the behave tests, run the following command in this repository:
In the future, this command will run all tests, but now only *behave* is
implemented. To learn more about the `test` subcommand, run:
python -m openappstack CLUSTERNAME test --help
## Known Issues
- Default ssh backend for testinfra tests is `paramiko`, which doesn't work oout
of the box. It fails to connect to the host because the `ed25519` hostkey was
not verified. Therefore we need to force plain ssh:// with either
# Running CI with local gitlab-runner docker executor
Export the following environment variables like this:

Maarten de Waard
committed
export CI_REGISTRY_IMAGE='open.greenhost.net:4567/openappstack/openappstack'
export SSH_PRIVATE_KEY="$(cat ~/.ssh/id_ed25519_oas_ci)"
export COSMOS_API_TOKEN='…'
then:
gitlab-runner exec docker --env CI_REGISTRY_IMAGE="$CI_REGISTRY_IMAGE" --env SSH_PRIVATE_KEY="$SSH_PRIVATE_KEY" --env COSMOS_API_TOKEN="$COSMOS_API_TOKEN" bootstrap