From 7e7f7d0ff18fa157e43d16b830e869df4be7260e Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Tue, 31 Oct 2023 19:36:03 +0100 Subject: [PATCH] build: incorporate condition changes in e2e Signed-off-by: Hidde Beydals --- .github/workflows/e2e.yaml | 19 ++++++++++--------- .../install-fail-remediate/helmrelease.yaml | 6 ++++-- .../install-fail-retry/helmrelease.yaml | 4 ++-- config/testdata/install-fail/helmrelease.yaml | 4 ++-- .../install-test-fail-ignore/helmrelease.yaml | 4 ++-- .../install-test-fail/helmrelease.yaml | 4 ++-- .../install.yaml | 4 ++-- .../upgrade.yaml | 4 ++-- .../upgrade-fail-remediate/install.yaml | 4 ++-- .../upgrade-fail-remediate/upgrade.yaml | 4 ++-- .../testdata/upgrade-fail-retry/install.yaml | 4 ++-- .../testdata/upgrade-fail-retry/upgrade.yaml | 4 ++-- config/testdata/upgrade-fail/install.yaml | 4 ++-- config/testdata/upgrade-fail/upgrade.yaml | 4 ++-- .../testdata/upgrade-test-fail/install.yaml | 4 ++-- .../testdata/upgrade-test-fail/upgrade.yaml | 4 ++-- config/testdata/valuesfrom/helmrelease.yaml | 2 +- 17 files changed, 43 insertions(+), 40 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 0fb3f546a..0792d1dc5 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -169,7 +169,7 @@ jobs: kubectl -n helm-system apply -f config/testdata/$test_name echo -n ">>> Waiting for expected conditions" count=0 - until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="False" and .TestSuccess=="False" and .Ready=="False"' )" ]; do + until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="True" and .TestSuccess=="False" and .Ready=="False"' )" ]; do echo -n '.' sleep 5 count=$((count + 1)) @@ -213,7 +213,7 @@ jobs: fi kubectl -n helm-system delete -f config/testdata/$test_name - - name: Run install fail with remedition test + - name: Run install fail with remediation test run: | test_name=install-fail-remediate kubectl -n helm-system apply -f config/testdata/$test_name @@ -230,21 +230,22 @@ jobs: done echo ' done' - # Ensure release does not exist (was uninstalled). - HISTORY=$(helm -n helm-system history $test_name 2>&1; exit 0) - if [ "$HISTORY" != 'Error: release: not found' ]; then - echo -e "Unexpected release history: $HISTORY" + # Ensure release was uninstalled. + RELEASE_STATUS=$(helm -n helm-system history $test_name -o json | jq -r 'if length == 1 then .[0].status else empty end') + if [ "$RELEASE_STATUS" != "uninstalled" ]; then + echo -e "Unexpected release status: $RELEASE_STATUS" exit 1 fi kubectl -n helm-system delete -f config/testdata/$test_name + helm -n helm-system delete $test_name - name: Run install fail with retry test run: | test_name=install-fail-retry kubectl -n helm-system apply -f config/testdata/$test_name echo -n ">>> Waiting for expected conditions" count=0 - until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.installFailures == 2 and ( .status.conditions | map( { (.type): .status } ) | add | .Released=="False" and .Ready=="False" )' )" ]; do + until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.installFailures == 2 and ( .status.conditions | map( { (.type): .status } ) | add | .Released=="False" and .Ready=="False" and .Stalled=="True" )' )" ]; do echo -n '.' sleep 5 count=$((count + 1)) @@ -290,7 +291,7 @@ jobs: kubectl -n helm-system apply -f config/testdata/$test_name/upgrade.yaml echo -n ">>> Waiting for expected conditions" count=0 - until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="False" and .Ready=="False"' )" ]; do + until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="False" and .Ready=="False" and .Stalled=="True"' )" ]; do echo -n '.' sleep 5 count=$((count + 1)) @@ -336,7 +337,7 @@ jobs: kubectl -n helm-system apply -f config/testdata/$test_name/upgrade.yaml echo -n ">>> Waiting for expected conditions" count=0 - until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="False" and .TestSuccess=="False" and .Ready=="False"' )" ]; do + until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="True" and .TestSuccess=="False" and .Ready=="False" and .Stalled=="True"' )" ]; do echo -n '.' sleep 5 count=$((count + 1)) diff --git a/config/testdata/install-fail-remediate/helmrelease.yaml b/config/testdata/install-fail-remediate/helmrelease.yaml index e464fe3ce..6dc456ce2 100644 --- a/config/testdata/install-fail-remediate/helmrelease.yaml +++ b/config/testdata/install-fail-remediate/helmrelease.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: install-fail-remediate spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,10 +11,12 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m install: remediation: remediateLastFailure: true + uninstall: + keepHistory: true values: resources: requests: diff --git a/config/testdata/install-fail-retry/helmrelease.yaml b/config/testdata/install-fail-retry/helmrelease.yaml index c222b95fa..0cb426996 100644 --- a/config/testdata/install-fail-retry/helmrelease.yaml +++ b/config/testdata/install-fail-retry/helmrelease.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: install-fail-retry spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m install: remediation: retries: 1 diff --git a/config/testdata/install-fail/helmrelease.yaml b/config/testdata/install-fail/helmrelease.yaml index 12935d988..ef39c6e12 100644 --- a/config/testdata/install-fail/helmrelease.yaml +++ b/config/testdata/install-fail/helmrelease.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: install-fail spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m values: resources: requests: diff --git a/config/testdata/install-test-fail-ignore/helmrelease.yaml b/config/testdata/install-test-fail-ignore/helmrelease.yaml index 93567f7cb..7d1ec59d8 100644 --- a/config/testdata/install-test-fail-ignore/helmrelease.yaml +++ b/config/testdata/install-test-fail-ignore/helmrelease.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: install-test-fail-ignore spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m test: enable: true ignoreFailures: true diff --git a/config/testdata/install-test-fail/helmrelease.yaml b/config/testdata/install-test-fail/helmrelease.yaml index 85a6e589a..62e9c15e9 100644 --- a/config/testdata/install-test-fail/helmrelease.yaml +++ b/config/testdata/install-test-fail/helmrelease.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: install-test-fail spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m test: enable: true values: diff --git a/config/testdata/upgrade-fail-remediate-uninstall/install.yaml b/config/testdata/upgrade-fail-remediate-uninstall/install.yaml index 8ea8c1ae7..832c233f1 100644 --- a/config/testdata/upgrade-fail-remediate-uninstall/install.yaml +++ b/config/testdata/upgrade-fail-remediate-uninstall/install.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-fail-remediate-uninstall spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m values: resources: requests: diff --git a/config/testdata/upgrade-fail-remediate-uninstall/upgrade.yaml b/config/testdata/upgrade-fail-remediate-uninstall/upgrade.yaml index a169b79b1..4bc6d5e0d 100644 --- a/config/testdata/upgrade-fail-remediate-uninstall/upgrade.yaml +++ b/config/testdata/upgrade-fail-remediate-uninstall/upgrade.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-fail-remediate-uninstall spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m upgrade: remediation: remediateLastFailure: true diff --git a/config/testdata/upgrade-fail-remediate/install.yaml b/config/testdata/upgrade-fail-remediate/install.yaml index 3ddb6b53c..6245ab226 100644 --- a/config/testdata/upgrade-fail-remediate/install.yaml +++ b/config/testdata/upgrade-fail-remediate/install.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-fail-remediate spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m values: resources: requests: diff --git a/config/testdata/upgrade-fail-remediate/upgrade.yaml b/config/testdata/upgrade-fail-remediate/upgrade.yaml index 07972aa03..5aa9558fc 100644 --- a/config/testdata/upgrade-fail-remediate/upgrade.yaml +++ b/config/testdata/upgrade-fail-remediate/upgrade.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-fail-remediate spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m upgrade: remediation: remediateLastFailure: true diff --git a/config/testdata/upgrade-fail-retry/install.yaml b/config/testdata/upgrade-fail-retry/install.yaml index e7512b10a..3b9f838ac 100644 --- a/config/testdata/upgrade-fail-retry/install.yaml +++ b/config/testdata/upgrade-fail-retry/install.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-fail-retry spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m values: resources: requests: diff --git a/config/testdata/upgrade-fail-retry/upgrade.yaml b/config/testdata/upgrade-fail-retry/upgrade.yaml index acf9c4b5c..993eca57c 100644 --- a/config/testdata/upgrade-fail-retry/upgrade.yaml +++ b/config/testdata/upgrade-fail-retry/upgrade.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-fail-retry spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m upgrade: remediation: retries: 1 diff --git a/config/testdata/upgrade-fail/install.yaml b/config/testdata/upgrade-fail/install.yaml index ec7872c7d..aec23ce27 100644 --- a/config/testdata/upgrade-fail/install.yaml +++ b/config/testdata/upgrade-fail/install.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-fail spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m values: resources: requests: diff --git a/config/testdata/upgrade-fail/upgrade.yaml b/config/testdata/upgrade-fail/upgrade.yaml index 52468c434..08ef7abaf 100644 --- a/config/testdata/upgrade-fail/upgrade.yaml +++ b/config/testdata/upgrade-fail/upgrade.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-fail spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m values: resources: requests: diff --git a/config/testdata/upgrade-test-fail/install.yaml b/config/testdata/upgrade-test-fail/install.yaml index a5644cbce..32216b5a9 100644 --- a/config/testdata/upgrade-test-fail/install.yaml +++ b/config/testdata/upgrade-test-fail/install.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-test-fail spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m values: resources: requests: diff --git a/config/testdata/upgrade-test-fail/upgrade.yaml b/config/testdata/upgrade-test-fail/upgrade.yaml index e976a63c0..96a3dac5c 100644 --- a/config/testdata/upgrade-test-fail/upgrade.yaml +++ b/config/testdata/upgrade-test-fail/upgrade.yaml @@ -3,7 +3,7 @@ kind: HelmRelease metadata: name: upgrade-test-fail spec: - interval: 5m + interval: 30s chart: spec: chart: podinfo @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m test: enable: true values: diff --git a/config/testdata/valuesfrom/helmrelease.yaml b/config/testdata/valuesfrom/helmrelease.yaml index d1ea55e58..53e6cb4ce 100644 --- a/config/testdata/valuesfrom/helmrelease.yaml +++ b/config/testdata/valuesfrom/helmrelease.yaml @@ -11,7 +11,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - interval: 1m + interval: 10m valuesFrom: - kind: ConfigMap name: valuesfrom-config