diff --git a/test/podspec_test.go b/test/podspec_test.go index 0444660d..8907c0ee 100644 --- a/test/podspec_test.go +++ b/test/podspec_test.go @@ -449,7 +449,7 @@ var _ = Describe( err = updateCluster(k8sClient, ctx, aeroCluster) Expect(err).ToNot(HaveOccurred()) - By("Using registry in CR") + By("Using registry and namespace in CR") aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName) Expect(err).ToNot(HaveOccurred()) @@ -474,27 +474,28 @@ var _ = Describe( operatorEnvVarRegistryNamespace) }) - It("Should be able to recover cluster after setting correct aerospike-init custom registry", func() { + It("Should be able to recover cluster after setting correct aerospike-init custom registry/namespace", func() { operatorEnvVarRegistry := "docker.io" operatorEnvVarRegistryNamespace := "aerospike" - incorrectCustomRegistry := "incorrect.registry" + incorrectCustomRegistryNamespace := "incorrectnamespace" By("Using incorrect registry in CR") aeroCluster, err := getCluster(k8sClient, ctx, clusterNamespacedName) Expect(err).ToNot(HaveOccurred()) - aeroCluster.Spec.PodSpec.AerospikeInitContainerSpec.ImageRegistry = incorrectCustomRegistry - aeroCluster.Spec.PodSpec.AerospikeInitContainerSpec.ImageRegistryNamespace = &operatorEnvVarRegistryNamespace + aeroCluster.Spec.PodSpec.AerospikeInitContainerSpec.ImageRegistryNamespace = &incorrectCustomRegistryNamespace err = updateClusterWithTO(k8sClient, ctx, aeroCluster, time.Minute*1) Expect(err).Should(HaveOccurred()) + validateImageRegistryNamespace(k8sClient, ctx, aeroCluster, operatorEnvVarRegistry, + incorrectCustomRegistryNamespace) + By("Using correct registry name") aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName) Expect(err).ToNot(HaveOccurred()) - // Empty imageRegistry, should use operator envVar docker.io - aeroCluster.Spec.PodSpec.AerospikeInitContainerSpec.ImageRegistry = operatorEnvVarRegistry - aeroCluster.Spec.PodSpec.AerospikeInitContainerSpec.ImageRegistryNamespace = &operatorEnvVarRegistryNamespace + // Nil ImageRegistryNamespace, should use operator envVar aerospike + aeroCluster.Spec.PodSpec.AerospikeInitContainerSpec.ImageRegistryNamespace = nil err = updateCluster(k8sClient, ctx, aeroCluster) Expect(err).ToNot(HaveOccurred()) diff --git a/test/test.sh b/test/test.sh index 8b1b83d5..a84d8754 100755 --- a/test/test.sh +++ b/test/test.sh @@ -20,7 +20,7 @@ do a ) ARGS="$OPTARG" ;; r ) REGISTRY="$OPTARG" ;; p ) CRED_PATH="$OPTARG" ;; - n ) NAMESPACE="$OPTARG" ;; + n ) REGISTRY_NAMESPACE="$OPTARG" ;; esac done @@ -28,7 +28,7 @@ done # Defaults CRED_PATH=${CRED_PATH:-$HOME/.docker/config.json} REGISTRY=${REGISTRY:-568976754000.dkr.ecr.ap-south-1.amazonaws.com} -NAMESPACE=${NAMESPACE:-aerospike} +REGISTRY_NAMESPACE=${REGISTRY_NAMESPACE:-aerospike} DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" @@ -62,7 +62,7 @@ echo "| Starting tests.... |" echo "---------------------" export CUSTOM_INIT_REGISTRY="$REGISTRY" -export CUSTOM_INIT_REGISTRY_NAMESPACE="$NAMESPACE" +export CUSTOM_INIT_REGISTRY_NAMESPACE="$REGISTRY_NAMESPACE" export IMAGE_PULL_SECRET_NAME="$IMAGE_PULL_SECRET" make test FOCUS="$FOCUS" ARGS="$ARGS"