From 4b58e159a8e723d3b1d6208bc158bc5f93fc8851 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Wed, 16 Oct 2024 16:42:08 -0700 Subject: [PATCH] [chore] Add testing by installing on GCE (#1496) --- .github/workflows/functional_test_v2.yaml | 41 +++++++++++++++++++++++ functional_tests/functional_test.go | 3 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/functional_test_v2.yaml b/.github/workflows/functional_test_v2.yaml index fcbd367222..6257a2588d 100644 --- a/.github/workflows/functional_test_v2.yaml +++ b/.github/workflows/functional_test_v2.yaml @@ -365,3 +365,44 @@ jobs: run: | cd functional_tests TEARDOWN_BEFORE_SETUP=true go test -v -tags functional + + gce-autopilot-test: + name: Test helm install in GCE (kops) - credentials needed + needs: kubernetes-test + if: github.event.pull_request.head.repo.full_name == github.repository + concurrency: + group: gce-access + env: + KUBE_TEST_ENV: gce + SKIP_TESTS: "true" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ~1.21.8 + cache: false + - name: Cache Go + id: go-cache + timeout-minutes: 5 + uses: actions/cache@v4 + with: + path: | + ~/go/bin + ~/go/pkg/mod + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Update dependencies + run: | + make dep-update + - name: Set kubeconfig + run: echo "$GCE_KUBECONFIG" > /tmp/kubeconfig + env: + GCE_KUBECONFIG: ${{ secrets.GCE_KUBECONFIG }} + - name: run functional tests + uses: mobiledevops/secret-to-file-action@v1 + env: + HOST_ENDPOINT: 0.0.0.0 + KUBECONFIG: /tmp/kubeconfig + run: | + cd functional_tests + TEARDOWN_BEFORE_SETUP=true go test -v -tags functional diff --git a/functional_tests/functional_test.go b/functional_tests/functional_test.go index cd9047eece..52ae9a62ae 100644 --- a/functional_tests/functional_test.go +++ b/functional_tests/functional_test.go @@ -69,6 +69,7 @@ const ( eksTestKubeEnv = "eks" autopilotTestKubeEnv = "gke/autopilot" aksTestKubeEnv = "aks" + gceTestKubeEnv = "gce" testDir = "testdata" valuesDir = "values" manifestsDir = "manifests" @@ -532,7 +533,7 @@ func Test_Functions(t *testing.T) { require.True(t, setKubeTestEnv, "the environment variable KUBE_TEST_ENV must be set") switch kubeTestEnv { - case kindTestKubeEnv, autopilotTestKubeEnv, aksTestKubeEnv: + case kindTestKubeEnv, autopilotTestKubeEnv, aksTestKubeEnv, gceTestKubeEnv: expectedValuesDir = kindValuesDir case eksTestKubeEnv: expectedValuesDir = eksValuesDir