Skip to content
Snippets Groups Projects
Verified Commit a387f775 authored by Varac's avatar Varac
Browse files

Use CLUSTER_DIR instead of INVENTORY in CI

parent cf3863d3
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ variables:
FQDN: "${CI_COMMIT_REF_SLUG}.ci.openappstack.net"
ANSIBLE_HOST_KEY_CHECKING: "False"
KANIKO_BUILD_IMAGENAME: "openappstack-ci"
INVENTORY: "/builds/openappstack/openappstack/clusters/${CI_COMMIT_REF_SLUG}/inventory.yml"
CLUSTER_DIR: "/builds/openappstack/openappstack/clusters/${CI_COMMIT_REF_SLUG}"
default:
image: "${CI_REGISTRY_IMAGE}/${KANIKO_BUILD_IMAGENAME}:${CI_COMMIT_REF_SLUG}"
......@@ -100,7 +100,7 @@ test_helmreleases:
script:
- cd ansible/
- export KUBECONFIG="${PWD}/../clusters/${HOSTNAME}/secrets/kube_config_cluster.yml"
- pytest -v -s -m 'helmreleases' --connection=ansible --ansible-inventory=${INVENTORY} --hosts='ansible://*' --reruns 120 --reruns-delay 10
- pytest -v -s -m 'helmreleases' --connection=ansible --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*' --reruns 120 --reruns-delay 10
only:
changes:
- .gitlab-ci.yml
......@@ -114,7 +114,7 @@ testinfra:
stage: health-test
script:
- cd ansible/
- pytest -v -m 'testinfra' --connection=ansible --ansible-inventory=${INVENTORY} --hosts='ansible://*'
- pytest -v -m 'testinfra' --connection=ansible --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*'
only:
changes:
- .gitlab-ci.yml
......@@ -129,7 +129,7 @@ certs:
allow_failure: true
script:
- cd ansible/
- pytest -s -m 'certs' --connection=ansible --ansible-inventory=${INVENTORY} --hosts='ansible://*'
- pytest -s -m 'certs' --connection=ansible --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*'
only:
changes:
- .gitlab-ci.yml
......@@ -144,7 +144,7 @@ prometheus-alerts:
allow_failure: true
script:
- cd test/
- pytest -s -m 'prometheus' --connection=ansible --ansible-inventory=${INVENTORY} --hosts='ansible://*'
- pytest -s -m 'prometheus' --connection=ansible --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*'
only:
changes:
- .gitlab-ci.yml
......
......@@ -13,13 +13,13 @@ There are two types of tests: "testinfra" tests, and "behave" tests.
## Run *testinfra* tests
Export `INVENTORY` env var to the location of your clusters inventory file:
Export `CLUSTER_DIR` env var with the location of your cluster config directory:
export INVENTORY=../clusters/CLUSTERNAME/inventory.yml
export CLUSTER_DIR="../clusters/CLUSTERNAME"
Run all tests:
py.test -sv --ansible-inventory=${INVENTORY} --hosts='ansible://*'
py.test -sv --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*'
Specify host manually:
......@@ -27,13 +27,13 @@ Specify host manually:
Run only tests tagged with `prometheus`:
py.test -sv --ansible-inventory=${INVENTORY} --hosts='ansible://*' -m prometheus
py.test -sv --ansible-inventory=${CLUSTER_DIR}/inventory.yml --hosts='ansible://*' -m prometheus
### Cert tests
Run cert test manually using the ansible inventory file:
py.test -sv --ansible-inventory=${INVENTORY} --hosts='ansible://*' -m certs
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:
......
......@@ -36,7 +36,7 @@ def test_helmreleases(host):
'oas-apps': ['nextcloud']
}
cluster_dir = os.path.dirname(os.environ.get("INVENTORY"))
cluster_dir = os.environ.get("CLUSTER_DIR")
kubeconfig = os.path.join(cluster_dir, 'secrets',
'kube_config_cluster.yml')
config.load_kube_config(config_file=kubeconfig)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment