@@ -499,6 +499,14 @@ TELEMETRY_KUTTL_CONF ?= ${TELEMETRY_KUTTL_BASEDIR}/kuttl-test.yaml
499499TELEMETRY_KUTTL_NAMESPACE ?= telemetry-kuttl-tests
500500TELEMETRY_KUTTL_DIR ?= ${TELEMETRY_KUTTL_BASEDIR}/${TELEMETRY_KUTTL_RELPATH}
501501
502+ # Test Operator
503+ TEST_OPERATOR_IMG ?= quay.io/openstack-k8s-operators/test-operator-index:${OPENSTACK_K8S_TAG}
504+ TEST_OPERATOR_REPO ?= https://github.com/openstack-k8s-operators/test-operator.git
505+ TEST_OPERATOR_BRANCH ?= ${OPENSTACK_K8S_BRANCH}
506+ TEST_OPERATOR_KUTTL_CONF ?= ${OPERATOR_BASE_DIR}/test-operator/kuttl-test.yaml
507+ TEST_OPERATOR_KUTTL_DIR ?= ${OPERATOR_BASE_DIR}/test-operator/test/kuttl/tests
508+ TEST_OPERATOR_KUTTL_NAMESPACE ?= test-operator-kuttl-tests
509+
502510# BMO
503511BMO_REPO ?= https://github.com/metal3-io/baremetal-operator
504512BMO_BRANCH ?= release-0.9
@@ -2743,6 +2751,57 @@ telemetry_kuttl: kuttl_common_prep ovn heat heat_deploy certmanager telemetry te
27432751 make kuttl_common_cleanup
27442752 bash scripts/restore-namespace.sh
27452753
2754+ # #@ TEST OPERATOR
2755+ .PHONY : test_operator_prep
2756+ test_operator_prep : export IMAGE=${TEST_IMG}
2757+ test_operator_prep : # # creates the files to install the operator using olm
2758+ $(eval $(call vars,$@ ,test-operator) )
2759+ bash scripts/gen-olm.sh
2760+
2761+ .PHONY : test_operator
2762+ test_operator : operator_namespace test_operator_prep # # installs the operator, also runs the prep step. Set TEST_IMG for custom image.
2763+ $(eval $(call vars,$@ ,test-operator) )
2764+ oc apply -f ${OPERATOR_DIR}
2765+
2766+ .PHONY : test_operator_cleanup # This one is already correct
2767+ test_operator_cleanup : # # deletes the operator, but does not cleanup the service resources
2768+ $(eval $(call vars,$@ ,test-operator) )
2769+ bash scripts/operator-cleanup.sh
2770+ ${CLEANUP_DIR_CMD} ${OPERATOR_DIR}
2771+
2772+ .PHONY : test_operator_deploy_prep
2773+ test_operator_deploy_prep : export KIND=Tempest
2774+ test_operator_deploy_prep : export REPO=${TEST_REPO}
2775+ test_operator_deploy_prep : export BRANCH=${TEST_BRANCH}
2776+ test_operator_deploy_prep : test_operator_deploy_cleanup # # prepares CR for test-operator
2777+ $(eval $(call vars,$@ ,test-operator) )
2778+ mkdir -p ${OPERATOR_BASE_DIR} ${OPERATOR_DIR} ${DEPLOY_DIR}
2779+ bash scripts/clone-operator-repo.sh
2780+
2781+ .PHONY : test_operator_deploy_cleanup # Already correct
2782+ test_operator_deploy_cleanup : # # cleans up the service instance, Does not affect the operator.
2783+ $(eval $(call vars,$@ ,test-operator) )
2784+ oc kustomize ${DEPLOY_DIR} | oc delete --ignore-not-found=true -f -
2785+ ${CLEANUP_DIR_CMD} ${DEPLOY_DIR}
2786+
2787+ .PHONY : test_operator_kuttl_run
2788+ test_operator_kuttl_run : # # runs kuttl tests for the test-operator, assumes that everything needed for running the test was deployed beforehand.
2789+ TEST_OPERATOR_KUTTL_DIR=${TEST_OPERATOR_KUTTL_DIR} kubectl-kuttl test --config ${TEST_OPERATOR_KUTTL_CONF} ${TEST_OPERATOR_KUTTL_DIR} --namespace ${NAMESPACE}
2790+ $(KUTTL_ARGS)
2791+
2792+ .PHONY : test_operator_kuttl
2793+ test_operator_kuttl : export NAMESPACE = ${TEST_OPERATOR_KUTTL_NAMESPACE}
2794+ # Set the value of $TEST_OPERATOR_KUTTL_NAMESPACE if you want to run test-operator
2795+ # kuttl tests in a namespace different than the default (test-operator-kuttl-tests)
2796+ test_operator_kuttl : kuttl_common_prep test_operator test_operator_deploy_prep
2797+ $(eval $(call vars,$@ ,test-operator) )
2798+ make wait
2799+ make test_operator_kuttl_run
2800+ make deploy_cleanup
2801+ make test_operator_cleanup
2802+ make kuttl_common_cleanup
2803+
2804+
27462805# #@ SWIFT
27472806.PHONY : swift_prep
27482807swift_prep : export IMAGE=${SWIFT_IMG}
0 commit comments