From 83415d0e596c8dd1d2d59cdb3fb18216c1e4bc21 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Tue, 13 Apr 2021 15:32:22 +0200 Subject: [PATCH] Reduce false positives in chart testing Without this change, the "Test helm chart (install) action" will rightfully succeed when our helm chart gets installed and has no syntax issues. However, it doesn't test if kured is properly installed. For example, the helm chart can try to install a yet unpublished image, and our test will succeed, as the syntax is still valid. This is a problem, as everything looks green, but it's not effectively working. Our other jobs are focusing on code changes, so they rightfully override the image tag, which is not what we want in this "Test helm chart" action. This fixes it by adding an extra job in the workflow, depending on the chart testing. --- .github/workflows/on-pr-charts.yaml | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/on-pr-charts.yaml b/.github/workflows/on-pr-charts.yaml index 68574cc..cbd6bb1 100644 --- a/.github/workflows/on-pr-charts.yaml +++ b/.github/workflows/on-pr-charts.yaml @@ -39,3 +39,35 @@ jobs: - name: Run chart tests run: ct ${{ matrix.test-action }} --config .github/ct.yaml + + # This doesn't re-use the ct actions, due to many limitations (auto tear down, no real testing) + deploy-chart: + name: "Functional test of helm chart with pre-published images" + runs-on: ubuntu-latest + needs: test-chart + steps: + - uses: actions/checkout@v2 + + # Default name for helm/kind-action kind clusters is "chart-testing" + - name: Create 1 node kind cluster + uses: helm/kind-action@master + + - name: Deploy kured on default namespace with its helm chart + run: | + # Documented in official helm doc to live on the edge + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + # Refresh bins + hash -r + helm install kured ./charts/kured/ --set configuration.period=1m --wait + kubectl config set-context kind-chart-testing + kubectl get ds --all-namespaces + kubectl describe ds kured + + - name: Test if successful deploy + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 10 + max_attempts: 10 + retry_wait_seconds: 10 + # DESIRED CURRENT READY UP-TO-DATE AVAILABLE should all be = to cluster_size + command: "kubectl get ds kured | grep -E 'kured.*1.*1.*1.*1.*1'" \ No newline at end of file