From 0fa465403442e38c14e8e227068df5bd29649254 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Tue, 22 Dec 2020 12:46:03 +0200 Subject: [PATCH] Add label prefix e2e test Signed-off-by: Stefan Prodan --- test/kubernetes/install.sh | 2 +- test/kubernetes/test-deployment.sh | 11 +++++++++++ test/workloads/deployment.yaml | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test/kubernetes/install.sh b/test/kubernetes/install.sh index 018622716..dd41d9b7e 100755 --- a/test/kubernetes/install.sh +++ b/test/kubernetes/install.sh @@ -12,4 +12,4 @@ kubectl apply -k ${REPO_ROOT}/kustomize/kubernetes kubectl -n flagger-system set image deployment/flagger flagger=test/flagger:latest kubectl -n flagger-system rollout status deployment/flagger -kubectl -n flagger-system rollout status deployment/flagger-prometheus \ No newline at end of file +kubectl -n flagger-system rollout status deployment/flagger-prometheus diff --git a/test/kubernetes/test-deployment.sh b/test/kubernetes/test-deployment.sh index 42cb7a2d5..836e44e7d 100755 --- a/test/kubernetes/test-deployment.sh +++ b/test/kubernetes/test-deployment.sh @@ -72,6 +72,17 @@ until ${ok}; do fi done +passed=$(kubectl -n test get deploy/podinfo-primary -oyaml 2>&1 | { grep test-label-prefix || true; }) +if [ -z "$passed" ]; then + echo -e '\u2716 primary copy labels by prefix test failed' + exit 1 +fi +passed=$(kubectl -n test get deploy/podinfo-primary -oyaml 2>&1 | { grep test-annotation-prefix || true; }) +if [ -z "$passed" ]; then + echo -e '\u2716 primary copy annotations by prefix test failed' + exit 1 +fi + echo '✔ Canary initialization test passed' echo '>>> Triggering canary deployment' diff --git a/test/workloads/deployment.yaml b/test/workloads/deployment.yaml index 175803d9b..390baa329 100644 --- a/test/workloads/deployment.yaml +++ b/test/workloads/deployment.yaml @@ -4,7 +4,10 @@ metadata: name: podinfo namespace: test labels: - app: podinfo + app.kubernetes.io/name: podinfo + app.kubernetes.io/managed-by: test-label-prefix + annotations: + app.kubernetes.io/instance: test-annotation-prefix spec: minReadySeconds: 5 revisionHistoryLimit: 5