diff --git a/tools/deployment/common/run-helm-tests.sh b/tools/deployment/common/run-helm-tests.sh new file mode 100755 index 0000000000..17fd52990a --- /dev/null +++ b/tools/deployment/common/run-helm-tests.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -x + +APPLICATION=$1 +RELEASE_GROUP=${2:-${APPLICATION}} +NAMESPACE=${3:-openstack} +: ${HELM_TESTS_TRIES:=2} +timeout=${OSH_TEST_TIMEOUT:-900} + +run_tests() { + # Delete the test pod if it still exists + kubectl delete pods -l application=${APPLICATION},release_group=${RELEASE_GROUP},component=test --namespace=${NAMESPACE} --ignore-not-found + helm test ${APPLICATION} --timeout $timeout +} + +for i in $(seq 1 ${HELM_TESTS_TRIES}); do + echo "Run helm tests for ${APPLICATION}. Try #${i}" + run_tests + RC=$? + [ ${RC} -eq "0" ] && break +done +exit ${RC} diff --git a/tools/deployment/component/compute-kit/compute-kit.sh b/tools/deployment/component/compute-kit/compute-kit.sh index da8ca2843e..ec2f14605f 100755 --- a/tools/deployment/component/compute-kit/compute-kit.sh +++ b/tools/deployment/component/compute-kit/compute-kit.sh @@ -148,10 +148,5 @@ if [ "x${RUN_HELM_TESTS}" == "xno" ]; then exit 0 fi -# Delete the test pods if they still exist -kubectl delete pods -l application=nova,release_group=nova,component=test --namespace=openstack --ignore-not-found -kubectl delete pods -l application=neutron,release_group=neutron,component=test --namespace=openstack --ignore-not-found - -timeout=${OSH_TEST_TIMEOUT:-900} -helm test nova --timeout $timeout -helm test neutron --timeout $timeout +./tools/deployment/common/run-helm-tests.sh nova +./tools/deployment/common/run-helm-tests.sh neutron diff --git a/tools/deployment/component/glance/glance.sh b/tools/deployment/component/glance/glance.sh index fb627a08b8..60a59ad786 100755 --- a/tools/deployment/component/glance/glance.sh +++ b/tools/deployment/component/glance/glance.sh @@ -16,6 +16,7 @@ set -xe #NOTE: Get the over-rides to use : ${OSH_EXTRA_HELM_ARGS_GLANCE:="$(./tools/deployment/common/get-values-overrides.sh glance)"} +: ${RUN_HELM_TESTS:="yes"} #NOTE: Lint and package chart make glance @@ -60,4 +61,8 @@ sleep 30 #NOTE(portdirect): Wait for ingress controller to update rules and rest openstack image list openstack image show 'Cirros 0.3.5 64-bit' -helm test glance --timeout 900 +if [ "x${RUN_HELM_TESTS}" == "xno" ]; then + exit 0 +fi + +./tools/deployment/common/run-helm-tests.sh glance diff --git a/tools/deployment/component/keystone/keystone.sh b/tools/deployment/component/keystone/keystone.sh index f32bd815e3..da985b524a 100755 --- a/tools/deployment/component/keystone/keystone.sh +++ b/tools/deployment/component/keystone/keystone.sh @@ -16,6 +16,7 @@ set -xe #NOTE: Get the over-rides to use : ${OSH_EXTRA_HELM_ARGS_KEYSTONE:="$(./tools/deployment/common/get-values-overrides.sh keystone)"} +: ${RUN_HELM_TESTS:="yes"} #NOTE: Lint and package chart make keystone @@ -61,9 +62,9 @@ FEATURE_GATE="ldap"; if [[ ${FEATURE_GATES//,/ } =~ (^|[[:space:]])${FEATURE_GAT http://keystone.openstack.svc.cluster.local/v3/domains/${domainId}/config fi -# Delete the test pod if it still exists -kubectl delete pods -l application=keystone,release_group=keystone,component=test --namespace=openstack --ignore-not-found -helm test keystone --timeout 900 +if [ "x${RUN_HELM_TESTS}" != "xno" ]; then + ./tools/deployment/common/run-helm-tests.sh keystone +fi FEATURE_GATE="tls"; if [[ ${FEATURE_GATES//,/ } =~ (^|[[:space:]])${FEATURE_GATE}($|[[:space:]]) ]]; then curl --cacert /etc/openstack-helm/certs/ca/ca.pem -L https://keystone.openstack.svc.cluster.local diff --git a/zuul.d/jobs-openstack-helm.yaml b/zuul.d/jobs-openstack-helm.yaml index dc374f33db..e6f806f112 100644 --- a/zuul.d/jobs-openstack-helm.yaml +++ b/zuul.d/jobs-openstack-helm.yaml @@ -167,16 +167,17 @@ openstack_release: stein container_distro_name: ubuntu container_distro_version: bionic + run_helm_tests: "no" gate_scripts_relative_path: ../openstack-helm gate_scripts: - ./tools/deployment/common/install-packages.sh - ./tools/deployment/common/deploy-k8s.sh - - ./tools/deployment/common/setup-client.sh - ./tools/scripts/tls/cert-manager.sh - - - ./tools/deployment/component/common/ingress.sh - - - ./tools/deployment/component/common/mariadb.sh + - ./tools/deployment/component/common/ingress.sh + - - ./tools/deployment/component/common/rabbitmq.sh + - ./tools/deployment/component/common/mariadb.sh - ./tools/deployment/component/common/memcached.sh - - ./tools/deployment/component/common/rabbitmq.sh - - ./tools/deployment/component/nfs-provisioner/nfs-provisioner.sh - ./tools/deployment/component/keystone/keystone.sh - - ./tools/deployment/component/heat/heat.sh @@ -184,8 +185,13 @@ - ./tools/deployment/component/compute-kit/openvswitch.sh - ./tools/deployment/component/compute-kit/libvirt.sh - ./tools/deployment/component/compute-kit/compute-kit.sh + - - ./tools/deployment/common/run-helm-tests.sh neutron + - ./tools/deployment/common/run-helm-tests.sh nova + - ./tools/deployment/common/run-helm-tests.sh glance + - ./tools/deployment/common/run-helm-tests.sh keystone - ./tools/deployment/developer/common/170-setup-gateway.sh - ./tools/deployment/developer/common/900-use-it.sh + - job: name: openstack-helm-compute-kit-pike-ubuntu_xenial parent: openstack-helm-compute-kit