diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1a87d157e..06f51726d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -94,32 +94,34 @@ jobs: test: ${{ fromJSON(needs.setup-integration-tests.outputs.test_names) }} runs-on: ubuntu-latest steps: - # This step is needed to avoid running the integration tests if the secrets are not available. - # TODO: remove this step once we have a way to run integration tests on forks. - # https://github.com/Kong/kubernetes-testing-framework/issues/596 - - name: Detect if we should run (have required secrets) - id: detect_if_should_run + # This step is needed to avoid running the integration tests requiring an enterprise license + # if the secrets are not available. + - name: Detect if we should run test cases requring an enterprise license (have required secrets) + id: detect_if_should_run_enterprise run: echo "result=${{ secrets.PULP_PASSWORD != '' }}" >> $GITHUB_OUTPUT + - name: Set environment variable to enable test cases requiring an enterprise license + if: steps.detect_if_should_run_enterprise.outputs.result == 'true' + id: set_run_enterprise_env + run: echo "KTF_TEST_RUN_ENTERPRISE_CASES=true" >> $GITHUB_ENV + - name: checkout repository uses: actions/checkout@v3 with: fetch-depth: 0 - uses: Kong/kong-license@master - if: steps.detect_if_should_run.outputs.result == 'true' + if: steps.detect_if_should_run_enterprise.outputs.result == 'true' id: license with: password: ${{ secrets.PULP_PASSWORD }} - name: setup golang - if: steps.detect_if_should_run.outputs.result == 'true' uses: actions/setup-go@v4 with: go-version: '^1.19' - name: run integration test ${{ matrix.test }} - if: steps.detect_if_should_run.outputs.result == 'true' run: make test.integration env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -134,7 +136,6 @@ jobs: # somewhat defeats the purpose of uploading those reports. Why bother uploading # if we don't care if the upload's successful? - name: Upload coverage to Codecov - if: steps.detect_if_should_run.outputs.result == 'true' uses: Wandalen/wretry.action@v1.0.36 with: action: codecov/codecov-action@v3 diff --git a/go.mod b/go.mod index 91ef194a8..4735a726e 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/stretchr/testify v1.8.2 golang.org/x/oauth2 v0.7.0 golang.org/x/sync v0.1.0 - google.golang.org/api v0.118.0 + google.golang.org/api v0.119.0 k8s.io/api v0.27.1 k8s.io/apiextensions-apiserver v0.27.1 k8s.io/apimachinery v0.27.1 @@ -36,7 +36,7 @@ require ( sigs.k8s.io/yaml v1.3.0 ) -require github.com/google/s2a-go v0.1.0 // indirect +require github.com/google/s2a-go v0.1.2 // indirect require ( cloud.google.com/go/compute v1.19.0 // indirect @@ -139,7 +139,7 @@ require ( golang.org/x/text v0.9.0 // indirect golang.org/x/time v0.3.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/grpc v1.54.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index afe7acef3..e240daf0c 100644 --- a/go.sum +++ b/go.sum @@ -211,8 +211,8 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.0 h1:3Qm0liEiCErViKERO2Su5wp+9PfMRiuS6XB5FvpKnYQ= -github.com/google/s2a-go v0.1.0/go.mod h1:OJpEgntRZo8ugHpF9hkoLJbS5dSI20XZeXJ9JVywLlM= +github.com/google/s2a-go v0.1.2 h1:WVtYAYuYxKeYajAmThMRYWP6K3wXkcqbGHeUgeubUHY= +github.com/google/s2a-go v0.1.2/go.mod h1:OJpEgntRZo8ugHpF9hkoLJbS5dSI20XZeXJ9JVywLlM= github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2/go.mod h1:Tv1PlzqC9t8wNnpPdctvtSUOPUUg4SHeE6vR1Ir2hmg= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= @@ -680,8 +680,8 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.118.0 h1:FNfHq9Z2GKULxu7cEhCaB0wWQHg43UpomrrN+24ZRdE= -google.golang.org/api v0.118.0/go.mod h1:76TtD3vkgmZ66zZzp72bUUklpmQmKlhh6sYtIjYK+5E= +google.golang.org/api v0.119.0 h1:Dzq+ARD6+8jmd5wknJE1crpuzu1JiovEU6gCp9PkoKA= +google.golang.org/api v0.119.0/go.mod h1:CrSvlNEFCFLae9ZUtL1z+61+rEBD7J/aCYwVYKZoWFU= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -728,8 +728,8 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd h1:sLpv7bNL1AsX3fdnWh9WVh7ejIzXdOc1RRHGeAmeStU= -google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/test/integration/enterprise_test.go b/test/integration/enterprise_test.go index 2ede206b6..ba4e092ab 100644 --- a/test/integration/enterprise_test.go +++ b/test/integration/enterprise_test.go @@ -25,6 +25,7 @@ import ( ) func TestKongEnterprisePostgres(t *testing.T) { + SkipEnterpriseTestIfNoEnv(t) t.Parallel() t.Log("preparing kong enterprise secrets") diff --git a/test/integration/suite_test.go b/test/integration/suite_test.go index 32009b101..fe3460bd1 100644 --- a/test/integration/suite_test.go +++ b/test/integration/suite_test.go @@ -5,6 +5,8 @@ package integration import ( "context" + "os" + "testing" ) // ----------------------------------------------------------------------------- @@ -15,3 +17,12 @@ var ( // ctx is a common context that can be used between tests ctx = context.Background() ) + +// SkipEnterpriseTestIfNoEnv skips test cases that requires an enterprise license +// if environment variable KTF_TEST_RUN_ENTERPRISE_CASES is not set. +// The function should be called at the beginning of test cases requiring an enterprise license. +func SkipEnterpriseTestIfNoEnv(t *testing.T) { + if os.Getenv("KTF_TEST_RUN_ENTERPRISE_CASES") != "true" { + t.Skip("skipped the test requiring kong enterprise license") + } +}