Skip to content

Commit 4ac6d42

Browse files
committed
Refactor openstack_kuttl targets so they can be run individually
The setup of the Makefile targets for running the openstack-operator kuttl tests made it more difficult to run individual tests, pass individual cli args to kuttl, and run tests from a modified openstack-oeprator checkout. After this refactor, kuttl tests are more easily run like: [stack@host06 install_yamls]$ make openstack_kuttl_prep [stack@host06 install_yamls]$ cd ../openstack-operator [stack@host06 openstack-operator]$ bin/kubectl-kuttl test --config kuttl-test.yaml test/kuttl/tests --test dataplane-create-test [stack@host06 install_yamls]$ cd ../install_yamls [stack@host06 install_yamls]$ make openstack_kuttl_cleanup Also cleans up the old ansibleee targets since that operator has been removed. Signed-off-by: James Slagle <jslagle@redhat.com>
1 parent bdf4c93 commit 4ac6d42

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
@@ -610,7 +598,7 @@ help: ## Display this help.
610598
@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)
611599

612600
.PHONY: cleanup
613-
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
601+
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
614602

615603
.PHONY: deploy_cleanup
616604
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
@@ -1994,33 +1982,6 @@ heat_kuttl: kuttl_common_prep heat heat_deploy_prep ## runs kuttl tests for the
19941982
.PHONY: heat_kuttl_crc
19951983
heat_kuttl_crc: crc_storage heat_kuttl
19961984

1997-
.PHONY: ansibleee_kuttl_run
1998-
ansibleee_kuttl_run: ## runs kuttl tests for the openstack-ansibleee operator, assumes that everything needed for running the test was deployed beforehand.
1999-
ANDIBLEEE_KUTTL_DIR=${ANSIBLEEE_KUTTL_DIR} kubectl-kuttl test --config ${ANSIBLEEE_KUTTL_CONF} ${ANSIBLEEE_KUTTL_DIR} --namespace ${NAMESPACE} $(KUTTL_ARGS)
2000-
2001-
.PHONY: ansibleee_kuttl_cleanup
2002-
ansibleee_kuttl_cleanup:
2003-
$(eval $(call vars,$@,openstack-ansibleee))
2004-
${CLEANUP_DIR_CMD} ${OPERATOR_BASE_DIR}/openstack-ansibleee-operator
2005-
2006-
.PHONY: ansibleee_kuttl_prep
2007-
ansibleee_kuttl_prep: export REPO=${ANSIBLEEE_REPO}
2008-
ansibleee_kuttl_prep: export BRANCH=${ANSIBLEEE_BRANCH}
2009-
ansibleee_kuttl_prep: export HASH=${ANSIBLEEE_COMMIT_HASH}
2010-
ansibleee_kuttl_prep: ansibleee_kuttl_cleanup
2011-
$(eval $(call vars,$@,openstack-ansibleee))
2012-
mkdir -p ${OPERATOR_BASE_DIR} ${OPERATOR_DIR}
2013-
bash scripts/clone-operator-repo.sh
2014-
2015-
.PHONY: ansibleee_kuttl
2016-
ansibleee_kuttl: export NAMESPACE= ${ANSIBLEEE_KUTTL_NAMESPACE}
2017-
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.
2018-
$(eval $(call vars,$@,openstack-ansibleee))
2019-
make wait
2020-
make ansibleee_kuttl_run
2021-
make ansibleee_cleanup
2022-
bash scripts/restore-namespace.sh
2023-
20241985
.PHONY: glance_kuttl_run
20251986
glance_kuttl_run: ## runs kuttl tests for the glance operator, assumes that everything needed for running the test was deployed beforehand.
20261987
GLANCE_KUTTL_DIR=${GLANCE_KUTTL_DIR} kubectl-kuttl test --config ${GLANCE_KUTTL_CONF} ${GLANCE_KUTTL_DIR} --namespace ${NAMESPACE} $(KUTTL_ARGS)
@@ -2085,6 +2046,19 @@ horizon_kuttl: kuttl_common_prep horizon horizon_deploy_prep ## runs kuttl tests
20852046
make horizon_cleanup
20862047
make kuttl_common_cleanup
20872048

2049+
.PHONY: openstack_kuttl_prep
2050+
openstack_kuttl_prep: export NAMESPACE = ${OPENSTACK_KUTTL_NAMESPACE}
2051+
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.
2052+
# Wait until OLM installs openstack CRDs
2053+
timeout $(TIMEOUT) bash -c "while ! (oc get crd openstacks.operator.openstack.org); do sleep 1; done"
2054+
make openstack_init
2055+
$(eval $(call vars,$@,infra))
2056+
make wait
2057+
$(eval $(call vars,$@,openstack-baremetal))
2058+
make wait
2059+
$(eval $(call vars,$@,openstack))
2060+
make wait
2061+
20882062
.PHONY: openstack_kuttl_run
20892063
openstack_kuttl_run: ## runs kuttl tests for the openstack operator, assumes that everything needed for running the test was deployed beforehand.
20902064
set -e; \
@@ -2095,23 +2069,17 @@ openstack_kuttl_run: ## runs kuttl tests for the openstack operator, assumes tha
20952069
kubectl-kuttl test --config ${OPENSTACK_KUTTL_CONF} ${OPENSTACK_KUTTL_DIR} --test $${test_dir}; \
20962070
done
20972071

2072+
.PHONY: openstack_kuttl_cleanup
2073+
openstack_kuttl_cleanup: export NAMESPACE = ${OPENSTACK_KUTTL_NAMESPACE}
2074+
openstack_kuttl_cleanup:
2075+
make openstack_deploy_cleanup
2076+
make openstack_cleanup
2077+
20982078
.PHONY: openstack_kuttl
20992079
openstack_kuttl: export NAMESPACE = ${OPENSTACK_KUTTL_NAMESPACE}
2100-
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.
2101-
# Wait until OLM installs openstack CRDs
2102-
timeout $(TIMEOUT) bash -c "while ! (oc get crd openstacks.operator.openstack.org); do sleep 1; done"
2103-
make openstack_init
2104-
$(eval $(call vars,$@,ansibleee))
2105-
make wait
2106-
$(eval $(call vars,$@,infra))
2107-
make wait
2108-
$(eval $(call vars,$@,openstack-baremetal))
2109-
make wait
2110-
$(eval $(call vars,$@,openstack))
2111-
make wait
2080+
openstack_kuttl: openstack_kuttl_prep
21122081
make openstack_kuttl_run
2113-
make openstack_deploy_cleanup
2114-
make openstack_cleanup
2082+
make openstack_kuttl_cleanup
21152083

21162084
##@ CHAINSAW tests
21172085

@@ -2217,24 +2185,6 @@ heat_deploy_cleanup: ## cleans up the service instance, Does not affect the oper
22172185
oc kustomize ${DEPLOY_DIR} | oc delete --ignore-not-found=true -f -
22182186
${CLEANUP_DIR_CMD} ${OPERATOR_BASE_DIR}/heat-operator ${DEPLOY_DIR}
22192187

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

0 commit comments

Comments
 (0)