From c3eec9db2aa4e06dde5233c1f5fff92461485fe2 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Thu, 9 May 2024 08:25:09 -0700 Subject: [PATCH] TIKA-4232 Create and execute unit tests for tika-helm --- .github/workflows/lint-test.yaml | 30 ++++++++++++++++++++++++++++-- .github/workflows/pluto.yaml | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 6e96eb9..e1cc61e 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -45,13 +45,39 @@ jobs: if [[ -n "$changed" ]]; then echo "::set-output name=changed::true" fi + shell: bash - name: Run chart-testing (lint) run: ct lint --target-branch ${{ github.event.repository.default_branch }} --charts . + shell: bash - name: Create kind cluster uses: helm/kind-action@v1.10.0 if: steps.list-changed.outputs.changed == 'true' + - name: Uninstall helm-unittest if present + run: | + helm plugin uninstall unittest >/dev/null 2>/dev/null \ + || echo "Failed to uninstall plugin, assuming it's not present." + shell: bash + - name: Install latest helm-unittest + run: | + echo "Installing latest version of helm-unittest" + helm plugin install https://github.com/helm-unittest/helm-unittest >/dev/null 2>/dev/null + shell: bash + - name: Assemble list of chart directories to test + run: | + tr ' ' '\n' <<< . | grep -v '^$' > charts-to-test || true + find . -type f -name 'Chart.yaml' -exec dirname {} \; > all-charts + [ -z . ] && mv all-charts charts-to-test || true + shell: bash + - name: Fetch chart dependencies + run: | + for chart in $(cat charts-to-test); do + helm dependency update "$chart" >/dev/null + done + shell: bash - name: Run unit tests - uses: d3adb5/helm-unittest-action@v2 + run: helm unittest --color $(cat charts-to-test) + shell: bash - name: Run chart-testing (install) + if: steps.list-changed.outputs.changed == 'true' run: ct install --target-branch ${{ github.event.repository.default_branch }} --charts . - if: steps.list-changed.outputs.changed == 'true' \ No newline at end of file + shell: bash diff --git a/.github/workflows/pluto.yaml b/.github/workflows/pluto.yaml index b3cd69c..d246f5e 100644 --- a/.github/workflows/pluto.yaml +++ b/.github/workflows/pluto.yaml @@ -35,8 +35,10 @@ jobs: wget https://github.com/FairwindsOps/pluto/releases/download/v${{ env.PLUTO_VERSION }}/pluto_${{ env.PLUTO_VERSION }}_linux_amd64.tar.gz -O - | tar -xz mv pluto /usr/local/bin/pluto chmod +x /usr/local/bin/pluto + shell: bash - name: Set up Helm uses: azure/setup-helm@v4.2.0 - name: verify helm chart run: | helm template . | pluto detect -omarkdown - >> $GITHUB_STEP_SUMMARY + shell: bash