diff --git a/Sanity/key_management_test/runtest.sh b/Sanity/key_management_test/runtest.sh index c3ffc8e..766d958 100755 --- a/Sanity/key_management_test/runtest.sh +++ b/Sanity/key_management_test/runtest.sh @@ -36,7 +36,10 @@ rlJournalStart rlRun ". ../../TestHelpers/functions.sh" || rlDie "cannot import function script" TO_ACTIVE_KEYS=60 #seconds TO_HIDDEN_KEYS=60 #seconds - + if [ -z "${OPERATOR_NAME}" ]; + then + OPERATOR_NAME=tang-operator + fi rlRun "${OC_CLIENT} apply -f ${TANG_FUNCTION_DIR}/reg_test/key_management_test/minimal-keyretrieve/daemons_v1alpha1_pv.yaml" 0 "Creating key management test pv" rlRun "${OC_CLIENT} apply -f ${TANG_FUNCTION_DIR}/reg_test/key_management_test/minimal-keyretrieve/daemons_v1alpha1_tangserver.yaml" 0 "Creating key management test tangserver" rlRun "ocpopCheckPodAmount 1 ${TO_POD_START} ${TEST_NAMESPACE}" 0 "Checking 1 POD is started [Timeout=${TO_POD_START} secs.]" @@ -75,6 +78,7 @@ rlJournalStart rlRun "${OC_CLIENT} apply -f ${TANG_FUNCTION_DIR}/reg_test/key_management_test/multiple-keyretrieve/daemons_v1alpha1_pv.yaml" 0 "Creating multiple key management test pv" rlRun "${OC_CLIENT} apply -f ${TANG_FUNCTION_DIR}/reg_test/key_management_test/multiple-keyretrieve/daemons_v1alpha1_tangserver.yaml" 0 "Creating multiple key management test tangserver" sed "s/{{OPERATOR_NAMESPACE}}/${OPERATOR_NAMESPACE}/g" < $TANG_FUNCTION_DIR/reg_test/key_management_test/multiple-keyretrieve/daemons_v1alpha1_clusterrolebinding.yaml | ${OC_CLIENT} apply -f - + sed "s/{{OPERATOR_NAME}}/${OPERATOR_NAME}/g" < $TANG_FUNCTION_DIR/reg_test/key_management_test/multiple-keyretrieve/daemons_v1alpha1_clusterrolebinding.yaml | ${OC_CLIENT} apply -f - rlRun "ocpopCheckPodAmount 3 ${TO_POD_START} ${TEST_NAMESPACE}" 0 "Checking 3 PODs are started [Timeout=${TO_POD_START} secs.]" pod1_name=$(ocpopGetPodNameWithPartialName "tang" "${TEST_NAMESPACE}" 5 1) pod2_name=$(ocpopGetPodNameWithPartialName "tang" "${TEST_NAMESPACE}" 5 2) @@ -88,6 +92,7 @@ rlJournalStart rlRun "${OC_CLIENT} delete -f ${TANG_FUNCTION_DIR}/reg_test/key_management_test/multiple-keyretrieve/daemons_v1alpha1_tangserver.yaml" 0 "Deleting key management test tangserver" rlRun "${OC_CLIENT} delete -f ${TANG_FUNCTION_DIR}/reg_test/key_management_test/multiple-keyretrieve/daemons_v1alpha1_pv.yaml" 0 "Deleting key management test pv" sed "s/{{OPERATOR_NAMESPACE}}/${OPERATOR_NAMESPACE}/g" < $TANG_FUNCTION_DIR/reg_test/key_management_test/multiple-keyretrieve/daemons_v1alpha1_clusterrolebinding.yaml | ${OC_CLIENT} delete -f - + sed "s/{{OPERATOR_NAME}}/${OPERATOR_NAME}/g" < $TANG_FUNCTION_DIR/reg_test/key_management_test/multiple-keyretrieve/daemons_v1alpha1_clusterrolebinding.yaml | ${OC_CLIENT} delete -f - rlRun "ocpopCheckPodAmount 0 ${TO_POD_STOP} ${TEST_NAMESPACE}" 0 "Checking no PODs continue running [Timeout=${TO_POD_STOP} secs.]" rlRun "ocpopCheckServiceAmount 0 ${TO_SERVICE_STOP} ${TEST_NAMESPACE}" 0 "Checking no Services continue running [Timeout=${TO_SERVICE_STOP} secs.]" rlPhaseEnd diff --git a/Sanity/malware_detection_test/runtest.sh b/Sanity/malware_detection_test/runtest.sh index c0ab9fd..7d9dd81 100755 --- a/Sanity/malware_detection_test/runtest.sh +++ b/Sanity/malware_detection_test/runtest.sh @@ -42,7 +42,11 @@ rlJournalStart ### Bundle Image analyzeVersion "${installed_version}" ### Container Image - controller_name=$(ocpopGetPodNameWithPartialName "tang-operator-controller" "${OPERATOR_NAMESPACE}" 1) + if [ -z "${OPERATOR_NAME}" ]; + then + OPERATOR_NAME=tang-operator + fi + controller_name=$(ocpopGetPodNameWithPartialName "${OPERATOR_NAME}-controller" "${OPERATOR_NAMESPACE}" 1) rlAssertNotEquals "Checking controller_name is not empty" "${controller_name}" "" container_image=$("${OC_CLIENT}" -n "${OPERATOR_NAMESPACE}" describe pod "${controller_name}" | grep tang | tr -d ' ' | grep "^Image:" | awk -F "Image:" '{print $2}' | tail -1) if [[ $container_image == *"registry.redhat.io"* ]];then diff --git a/Setup/clean_cluster/runtest.sh b/Setup/clean_cluster/runtest.sh index 7423d8e..c7cae93 100755 --- a/Setup/clean_cluster/runtest.sh +++ b/Setup/clean_cluster/runtest.sh @@ -36,13 +36,17 @@ rlJournalStart TO_POD_CONTROLLER_TERMINATE=180 #seconds (for controller to end must wait longer) rlRun "ocpopCheckClusterStatus" 0 "Checking cluster status" - controller_name=$(ocpopGetPodNameWithPartialName "tang-operator-controller" "${OPERATOR_NAMESPACE}" 1) + if [ -z "${OPERATOR_NAME}" ]; + then + OPERATOR_NAME=tang-operator + fi + controller_name=$(ocpopGetPodNameWithPartialName "${OPERATOR_NAME}-controller" "${OPERATOR_NAMESPACE}" 1) ocpopLogVerbose "Controller name:[${controller_name}]" if [ -n "${DOWNSTREAM_IMAGE_VERSION}" ] && [ "${DISABLE_BUNDLE_INSTALL_TESTS}" != "1" ]; then rlRun "uninstallDownstreamVersion" 0 "Uninstalling downstream version" fi - rlRun "bundleStop" 0 "Cleaning installed tang-operator" + rlRun "ocpopBundleStop" 0 "Cleaning installed operator" if [ "${DISABLE_BUNDLE_INSTALL_TESTS}" != "1" ] && [ "${DISABLE_BUNDLE_UNINSTALL_TESTS}" != "1" ]; then test -z "${controller_name}" || diff --git a/Setup/creating_test_namespace/runtest.sh b/Setup/creating_test_namespace/runtest.sh index acf6df1..fb42584 100755 --- a/Setup/creating_test_namespace/runtest.sh +++ b/Setup/creating_test_namespace/runtest.sh @@ -37,11 +37,15 @@ rlJournalStart rlRun ". ../../TestHelpers/functions.sh" || rlDie "cannot import function script" ocpopDumpDate ocpopDumpInfo + if [ -z "${OPERATOR_NAME}" ]; + then + OPERATOR_NAME=tang-operator + fi rlRun "ocpopDumpOpenShiftClientStatus" 0 "Checking OpenshiftClient installation" rlRun "operator-sdk version > /dev/null" 0 "Checking operator-sdk installation" rlRun "ocpopCheckClusterStatus" 0 "Checking cluster status" # In case previous execution was abruptelly stopped: - rlRun "bundleInitialStop" 0 "Cleaning already installed tang-operator (if any)" + rlRun "ocpopBundleInitialStop" 0 "Cleaning already installed operator (if any)" rlRun "bundleStart" 0 "Installing tang-operator-bundle version:${VERSION}" rlRun "${OC_CLIENT} apply -f ${TEST_NAMESPACE_FILE}" 0 "Creating test namespace:${TEST_NAMESPACE}" rlRun "${OC_CLIENT} get namespace ${TEST_NAMESPACE}" 0 "Checking test namespace:${TEST_NAMESPACE}" @@ -53,7 +57,7 @@ rlJournalStart rlPhaseStartTest "Controller runs appropriately" ########## CHECK CONTROLLER RUNS WITH NO ERRORS ######### - controller_name=$(ocpopGetPodNameWithPartialName "tang-operator-controller" "${OPERATOR_NAMESPACE}" "${TO_POD_START}") + controller_name=$(ocpopGetPodNameWithPartialName "${OPERATOR_NAME}-controller" "${OPERATOR_NAMESPACE}" "${TO_POD_START}") rlRun "ocpopCheckPodState Running ${TO_POD_START} ${OPERATOR_NAMESPACE} ${controller_name} Error" 0 \ "Checking controller POD in Running [Timeout=${TO_POD_START} secs.] and not in Error state" rlRun "ocpopCheckPodStateAndContinues Running ${TIMEOUT_CONTROLLER_KEEPS_RUNNING} ${OPERATOR_NAMESPACE} ${controller_name}" 0 \ diff --git a/TestHelpers/reg_test/key_management_test/minimal-keyretrieve-deletehiddenkeys/daemons_v1alpha1_clusterrolebinding.yaml b/TestHelpers/reg_test/key_management_test/minimal-keyretrieve-deletehiddenkeys/daemons_v1alpha1_clusterrolebinding.yaml index adf5e2d..cfd99ae 100644 --- a/TestHelpers/reg_test/key_management_test/minimal-keyretrieve-deletehiddenkeys/daemons_v1alpha1_clusterrolebinding.yaml +++ b/TestHelpers/reg_test/key_management_test/minimal-keyretrieve-deletehiddenkeys/daemons_v1alpha1_clusterrolebinding.yaml @@ -9,5 +9,5 @@ roleRef: name: pod-reader-executor subjects: - kind: ServiceAccount - name: tang-operator-controller-manager + name: {{OPERATOR_NAME}}-controller-manager namespace: {{OPERATOR_NAMESPACE}}