Skip to content

Commit d7ef01e

Browse files
Merge pull request #1130 from slagle/openstack-kuttl-prep
Refactor openstack_kuttl targets so they can be run individually
2 parents afd522e + 4ac6d42 commit d7ef01e

File tree

1 file changed

+22
-72
lines changed

1 file changed

+22
-72
lines changed

Makefile

Lines changed: 22 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -367,18 +367,6 @@ HEAT_KUTTL_CONF ?= ${OPERATOR_BASE_DIR}/heat-operator/kuttl-test.yaml
367367
HEAT_KUTTL_DIR ?= ${OPERATOR_BASE_DIR}/heat-operator/test/kuttl/tests
368368
HEAT_KUTTL_NAMESPACE ?= heat-kuttl-tests
369369

370-
# AnsibleEE
371-
ANSIBLEEE_IMG ?= quay.io/openstack-k8s-operators/openstack-ansibleee-operator-index:${OPENSTACK_K8S_TAG}
372-
ANSIBLEEE_REPO ?= https://github.com/openstack-k8s-operators/openstack-ansibleee-operator
373-
ANSIBLEEE_BRANCH ?= ${OPENSTACK_K8S_BRANCH}
374-
ANSIBLEE_COMMIT_HASH ?=
375-
ANSIBLEEE ?= config/samples/_v1beta1_ansibleee.yaml
376-
ANSIBLEEE_CR ?= ${OPERATOR_BASE_DIR}/openstack-ansibleee-operator/${ANSIBLEEE}
377-
ANSIBLEEE_KUTTL_CONF ?= ${OPERATOR_BASE_DIR}/openstack-ansibleee-operator/kuttl-test.yaml
378-
ANSIBLEEE_KUTTL_DIR ?= ${OPERATOR_BASE_DIR}/openstack-ansibleee-operator/test/kuttl/tests
379-
ANSIBLEEE_KUTTL_NAMESPACE ?= ansibleee-kuttl-tests
380-
381-
382370
# Baremetal Operator
383371
BAREMETAL_IMG ?= quay.io/openstack-k8s-operators/openstack-baremetal-operator-index:${OPENSTACK_K8S_TAG}
384372
BAREMETAL_REPO ?= https://github.com/openstack-k8s-operators/openstack-baremetal-operator.git
@@ -613,7 +601,7 @@ help: ## Display this help.
613601
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
614602

615603
.PHONY: cleanup
616-
cleanup: heat_cleanup horizon_cleanup nova_cleanup octavia_cleanup designate_cleanup neutron_cleanup ovn_cleanup ironic_cleanup cinder_cleanup glance_cleanup placement_cleanup swift_cleanup barbican_cleanup keystone_cleanup mariadb_cleanup telemetry_cleanup ansibleee_cleanup rabbitmq_cleanup infra_cleanup manila_cleanup metallb_cleanup ## Delete all operators
604+
cleanup: heat_cleanup horizon_cleanup nova_cleanup octavia_cleanup designate_cleanup neutron_cleanup ovn_cleanup ironic_cleanup cinder_cleanup glance_cleanup placement_cleanup swift_cleanup barbican_cleanup keystone_cleanup mariadb_cleanup telemetry_cleanup rabbitmq_cleanup infra_cleanup manila_cleanup metallb_cleanup ## Delete all operators
617605

618606
.PHONY: deploy_cleanup
619607
deploy_cleanup: manila_deploy_cleanup heat_deploy_cleanup horizon_deploy_cleanup nova_deploy_cleanup redis_deploy_cleanup octavia_deploy_cleanup designate_deploy_cleanup neutron_deploy_cleanup ovn_deploy_cleanup ironic_deploy_cleanup cinder_deploy_cleanup glance_deploy_cleanup placement_deploy_cleanup swift_deploy_cleanup barbican_deploy_cleanup keystone_deploy_cleanup redis_deploy_cleanup mariadb_deploy_cleanup telemetry_deploy_cleanup memcached_deploy_cleanup rabbitmq_deploy_cleanup ## Delete all OpenStack service objects
@@ -2000,33 +1988,6 @@ heat_kuttl: kuttl_common_prep heat heat_deploy_prep ## runs kuttl tests for the
20001988
.PHONY: heat_kuttl_crc
20011989
heat_kuttl_crc: crc_storage heat_kuttl
20021990

2003-
.PHONY: ansibleee_kuttl_run
2004-
ansibleee_kuttl_run: ## runs kuttl tests for the openstack-ansibleee operator, assumes that everything needed for running the test was deployed beforehand.
2005-
ANDIBLEEE_KUTTL_DIR=${ANSIBLEEE_KUTTL_DIR} kubectl-kuttl test --config ${ANSIBLEEE_KUTTL_CONF} ${ANSIBLEEE_KUTTL_DIR} --namespace ${NAMESPACE} $(KUTTL_ARGS)
2006-
2007-
.PHONY: ansibleee_kuttl_cleanup
2008-
ansibleee_kuttl_cleanup:
2009-
$(eval $(call vars,$@,openstack-ansibleee))
2010-
${CLEANUP_DIR_CMD} ${OPERATOR_BASE_DIR}/openstack-ansibleee-operator
2011-
2012-
.PHONY: ansibleee_kuttl_prep
2013-
ansibleee_kuttl_prep: export REPO=${ANSIBLEEE_REPO}
2014-
ansibleee_kuttl_prep: export BRANCH=${ANSIBLEEE_BRANCH}
2015-
ansibleee_kuttl_prep: export HASH=${ANSIBLEEE_COMMIT_HASH}
2016-
ansibleee_kuttl_prep: ansibleee_kuttl_cleanup
2017-
$(eval $(call vars,$@,openstack-ansibleee))
2018-
mkdir -p ${OPERATOR_BASE_DIR} ${OPERATOR_DIR}
2019-
bash scripts/clone-operator-repo.sh
2020-
2021-
.PHONY: ansibleee_kuttl
2022-
ansibleee_kuttl: export NAMESPACE= ${ANSIBLEEE_KUTTL_NAMESPACE}
2023-
ansibleee_kuttl: input ansibleee_kuttl_prep ansibleee ## runs kuttl tests for the openstack-ansibleee operator. Installs openstack-ansibleee operator and cleans up previous deployments before running the tests, add cleanup after running the tests.
2024-
$(eval $(call vars,$@,openstack-ansibleee))
2025-
make wait
2026-
make ansibleee_kuttl_run
2027-
make ansibleee_cleanup
2028-
bash scripts/restore-namespace.sh
2029-
20301991
.PHONY: glance_kuttl_run
20311992
glance_kuttl_run: ## runs kuttl tests for the glance operator, assumes that everything needed for running the test was deployed beforehand.
20321993
GLANCE_KUTTL_DIR=${GLANCE_KUTTL_DIR} kubectl-kuttl test --config ${GLANCE_KUTTL_CONF} ${GLANCE_KUTTL_DIR} --namespace ${NAMESPACE} $(KUTTL_ARGS)
@@ -2091,6 +2052,19 @@ horizon_kuttl: kuttl_common_prep horizon horizon_deploy_prep ## runs kuttl tests
20912052
make horizon_cleanup
20922053
make kuttl_common_cleanup
20932054

2055+
.PHONY: openstack_kuttl_prep
2056+
openstack_kuttl_prep: export NAMESPACE = ${OPENSTACK_KUTTL_NAMESPACE}
2057+
openstack_kuttl_prep: input deploy_cleanup openstack openstack_deploy_prep ## runs kuttl tests for the openstack operator. Installs openstack operator and cleans up previous deployments before running the tests, cleans up after running the tests.
2058+
# Wait until OLM installs openstack CRDs
2059+
timeout $(TIMEOUT) bash -c "while ! (oc get crd openstacks.operator.openstack.org); do sleep 1; done"
2060+
make openstack_init
2061+
$(eval $(call vars,$@,infra))
2062+
make wait
2063+
$(eval $(call vars,$@,openstack-baremetal))
2064+
make wait
2065+
$(eval $(call vars,$@,openstack))
2066+
make wait
2067+
20942068
.PHONY: openstack_kuttl_run
20952069
openstack_kuttl_run: ## runs kuttl tests for the openstack operator, assumes that everything needed for running the test was deployed beforehand.
20962070
set -e; \
@@ -2101,23 +2075,17 @@ openstack_kuttl_run: ## runs kuttl tests for the openstack operator, assumes tha
21012075
kubectl-kuttl test --config ${OPENSTACK_KUTTL_CONF} ${OPENSTACK_KUTTL_DIR} --test $${test_dir}; \
21022076
done
21032077

2078+
.PHONY: openstack_kuttl_cleanup
2079+
openstack_kuttl_cleanup: export NAMESPACE = ${OPENSTACK_KUTTL_NAMESPACE}
2080+
openstack_kuttl_cleanup:
2081+
make openstack_deploy_cleanup
2082+
make openstack_cleanup
2083+
21042084
.PHONY: openstack_kuttl
21052085
openstack_kuttl: export NAMESPACE = ${OPENSTACK_KUTTL_NAMESPACE}
2106-
openstack_kuttl: input deploy_cleanup openstack openstack_deploy_prep ## runs kuttl tests for the openstack operator. Installs openstack operator and cleans up previous deployments before running the tests, cleans up after running the tests.
2107-
# Wait until OLM installs openstack CRDs
2108-
timeout $(TIMEOUT) bash -c "while ! (oc get crd openstacks.operator.openstack.org); do sleep 1; done"
2109-
make openstack_init
2110-
$(eval $(call vars,$@,ansibleee))
2111-
make wait
2112-
$(eval $(call vars,$@,infra))
2113-
make wait
2114-
$(eval $(call vars,$@,openstack-baremetal))
2115-
make wait
2116-
$(eval $(call vars,$@,openstack))
2117-
make wait
2086+
openstack_kuttl: openstack_kuttl_prep
21182087
make openstack_kuttl_run
2119-
make openstack_deploy_cleanup
2120-
make openstack_cleanup
2088+
make openstack_kuttl_cleanup
21212089

21222090
##@ CHAINSAW tests
21232091

@@ -2223,24 +2191,6 @@ heat_deploy_cleanup: ## cleans up the service instance, Does not affect the oper
22232191
oc kustomize ${DEPLOY_DIR} | oc delete --ignore-not-found=true -f -
22242192
${CLEANUP_DIR_CMD} ${OPERATOR_BASE_DIR}/heat-operator ${DEPLOY_DIR}
22252193

2226-
##@ ANSIBLEEE
2227-
.PHONY: ansibleee_prep
2228-
ansibleee_prep: export IMAGE=${ANSIBLEEE_IMG}
2229-
ansibleee_prep: ## creates the files to install the operator using olm
2230-
$(eval $(call vars,$@,openstack-ansibleee))
2231-
bash scripts/gen-olm.sh
2232-
2233-
.PHONY: ansibleee
2234-
ansibleee: operator_namespace ansibleee_prep ## installs the operator, also runs the prep step. Set ansibleee_IMG for custom image.
2235-
$(eval $(call vars,$@,openstack-ansibleee))
2236-
oc apply -f ${OPERATOR_DIR}
2237-
2238-
.PHONY: ansibleee_cleanup
2239-
ansibleee_cleanup: ## deletes the operator, but does not cleanup the service resources
2240-
$(eval $(call vars,$@,openstack-ansibleee))
2241-
bash scripts/operator-cleanup.sh
2242-
${CLEANUP_DIR_CMD} ${OPERATOR_DIR}
2243-
22442194
##@ BAREMETAL
22452195
.PHONY: baremetal_prep
22462196
baremetal_prep: export IMAGE=${BAREMETAL_IMG}

0 commit comments

Comments
 (0)