From 4f006356cb09bc1b606ed357b2827fe8f414a1d2 Mon Sep 17 00:00:00 2001 From: Alper Rifat Ulucinar Date: Mon, 9 Oct 2023 23:21:32 +0300 Subject: [PATCH] Fix resource import test's new and old ID assertion - We need to use the operator `=` instead of `==` with sh Signed-off-by: Alper Rifat Ulucinar (cherry picked from commit 86a9e409058f64a77ff31af7fcafaf527ac9b1ab) --- internal/templates/02-assert.yaml.tmpl | 2 +- internal/templates/renderer_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/templates/02-assert.yaml.tmpl b/internal/templates/02-assert.yaml.tmpl index d1c8deb..f851203 100644 --- a/internal/templates/02-assert.yaml.tmpl +++ b/internal/templates/02-assert.yaml.tmpl @@ -14,6 +14,6 @@ commands: {{- end }} {{- end }} {{- if not $resource.Namespace }} -- script: new_id=$(${KUBECTL} get {{ $resource.KindGroup }}/{{ $resource.Name }} -o=jsonpath='{.status.atProvider.id}') && old_id=$(${KUBECTL} get {{ $resource.KindGroup }}/{{ $resource.Name }} -o=jsonpath='{.metadata.annotations.uptest-old-id}') && [ "$new_id" == "$old_id" ] +- script: new_id="$(${KUBECTL} get {{ $resource.KindGroup }}/{{ $resource.Name }} -o=jsonpath='{.status.atProvider.id}')" && old_id="$(${KUBECTL} get {{ $resource.KindGroup }}/{{ $resource.Name }} -o=jsonpath='{.metadata.annotations.uptest-old-id}')" && [ "$new_id" = "$old_id" ] {{- end }} {{- end }} diff --git a/internal/templates/renderer_test.go b/internal/templates/renderer_test.go index a44206c..6208734 100644 --- a/internal/templates/renderer_test.go +++ b/internal/templates/renderer_test.go @@ -114,7 +114,7 @@ timeout: 10 commands: - script: echo "Dump MR manifests for the import assertion step:"; ${KUBECTL} get managed -o yaml - command: ${KUBECTL} wait s3.aws.upbound.io/example-bucket --for=condition=Test --timeout 10s -- script: new_id=$(${KUBECTL} get s3.aws.upbound.io/example-bucket -o=jsonpath='{.status.atProvider.id}') && old_id=$(${KUBECTL} get s3.aws.upbound.io/example-bucket -o=jsonpath='{.metadata.annotations.uptest-old-id}') && [ "$new_id" == "$old_id" ] +- script: new_id="$(${KUBECTL} get s3.aws.upbound.io/example-bucket -o=jsonpath='{.status.atProvider.id}')" && old_id="$(${KUBECTL} get s3.aws.upbound.io/example-bucket -o=jsonpath='{.metadata.annotations.uptest-old-id}')" && [ "$new_id" = "$old_id" ] `, "02-import.yaml": `# This file belongs to the resource import step. apiVersion: kuttl.dev/v1beta1 @@ -221,7 +221,7 @@ timeout: 10 commands: - script: echo "Dump MR manifests for the import assertion step:"; ${KUBECTL} get managed -o yaml - command: ${KUBECTL} wait s3.aws.upbound.io/example-bucket --for=condition=Test --timeout 10s -- script: new_id=$(${KUBECTL} get s3.aws.upbound.io/example-bucket -o=jsonpath='{.status.atProvider.id}') && old_id=$(${KUBECTL} get s3.aws.upbound.io/example-bucket -o=jsonpath='{.metadata.annotations.uptest-old-id}') && [ "$new_id" == "$old_id" ] +- script: new_id="$(${KUBECTL} get s3.aws.upbound.io/example-bucket -o=jsonpath='{.status.atProvider.id}')" && old_id="$(${KUBECTL} get s3.aws.upbound.io/example-bucket -o=jsonpath='{.metadata.annotations.uptest-old-id}')" && [ "$new_id" = "$old_id" ] `, "02-import.yaml": `# This file belongs to the resource import step. apiVersion: kuttl.dev/v1beta1