Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed Aug 14, 2024
1 parent fd8866c commit ce580d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions test/podspec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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())

Expand Down
6 changes: 3 additions & 3 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ do
a ) ARGS="$OPTARG" ;;
r ) REGISTRY="$OPTARG" ;;
p ) CRED_PATH="$OPTARG" ;;
n ) NAMESPACE="$OPTARG" ;;
n ) REGISTRY_NAMESPACE="$OPTARG" ;;

esac
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 )"
Expand Down Expand Up @@ -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"

0 comments on commit ce580d7

Please sign in to comment.