From cf3863d3afb215e4013752815617fe5e81a7aa1b Mon Sep 17 00:00:00 2001 From: Varac <varac@varac.net> Date: Wed, 18 Dec 2019 13:46:09 +0100 Subject: [PATCH] Use FQDN env var for cert test --- .gitlab-ci.yml | 10 ++++------ test/README.md | 4 ++-- test/pytest/test_certs.py | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd502e6de..48bcec935 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ variables: # Repeated values, because we're not allowed to use a variable in a variable SUBDOMAIN: "${CI_COMMIT_REF_SLUG}.ci" DOMAIN: "openappstack.net" - ADDRESS: "${CI_COMMIT_REF_SLUG}.ci.openappstack.net" + 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" @@ -37,7 +37,7 @@ ci_test_image: create-vps: stage: create-vps script: - - echo "hostname $HOSTNAME, subdomain $SUBDOMAIN, domain $DOMAIN, address $ADDRESS"; + - echo "hostname $HOSTNAME, subdomain $SUBDOMAIN, domain $DOMAIN, FQDN $FQDN"; - ls clusters/${HOSTNAME} || echo "directory clusters/${HOSTNAME} not found" # Creates the VPS only if an old VPS for this branch is not re-usable - sh .gitlab/ci_scripts/create_vps.sh @@ -141,8 +141,6 @@ certs: prometheus-alerts: stage: health-test - variables: - OAS_DOMAIN: '${CI_COMMIT_REF_SLUG}.ci.openappstack.net' allow_failure: true script: - cd test/ @@ -159,9 +157,9 @@ behave-nextcloud: stage: integration-test script: # Wait until flux creates the NextCloud HelmRelease. - - ssh root@$ADDRESS '/bin/bash -c "while true; do kubectl get hr -n oas-apps nextcloud; if [ \$? -eq 0 ]; then break; fi; sleep 20; done"' + - ssh root@$FQDN '/bin/bash -c "while true; do kubectl get hr -n oas-apps nextcloud; if [ \$? -eq 0 ]; then break; fi; sleep 20; done"' # Wait until NextCloud is ready. - - ssh root@$ADDRESS '/bin/bash -c "kubectl wait -n oas-apps hr/nextcloud --for condition=Released --timeout=20m"' + - ssh root@$FQDN '/bin/bash -c "kubectl wait -n oas-apps hr/nextcloud --for condition=Released --timeout=20m"' # Run the behave tests for NextCloud. - python3 -m openappstack $HOSTNAME test --behave-headless --behave-tags nextcloud || python3 -m openappstack $HOSTNAME test --behave-headless --behave-rerun-failing --behave-tags nextcloud artifacts: diff --git a/test/README.md b/test/README.md index 4863ae121..7da4ce188 100644 --- a/test/README.md +++ b/test/README.md @@ -38,11 +38,11 @@ Run cert test manually using the ansible inventory file: Run cert test manually against a different cluster, not configured in any ansible inventory file, either by using pytest: - DOMAIN='example.openappstack.net' py.test -sv -m 'certs' + FQDN='example.openappstack.net' py.test -sv -m 'certs' or directly: - DOMAIN='example.openappstack.net' pytest/test_certs.py + FQDN='example.openappstack.net' pytest/test_certs.py ## Run *behave* tests diff --git a/test/pytest/test_certs.py b/test/pytest/test_certs.py index e4037ea51..93feb1a5a 100755 --- a/test/pytest/test_certs.py +++ b/test/pytest/test_certs.py @@ -101,11 +101,11 @@ def test_cert_validation(host): Check is executed on the local provisioning machine. """ - # Use DOMAIN env var if set, otherwise use domain var from + # Use FQDN env var if set, otherwise use domain var from # settings.yml. - domain = os.environ.get("DOMAIN") + domain = os.environ.get("FQDN") if domain: - print("Using domain %s from DOMAIN environment variable." % domain) + print("Using domain %s from FQDN environment variable." % domain) else: ansible_vars = host.ansible.get_variables() domain = ansible_vars["domain"] -- GitLab