diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3bd1fc2f1..de56a5be8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -51,12 +51,11 @@ jobs: ~/go/pkg/mod ~/go/bin key: unittest-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }} - - name: Run unit tests - run: make test-coverage + - run: make test-coverage - test_cel_validation: + test_crdcel: if: github.event_name == 'pull_request' || github.event_name == 'push' - name: CEL Validation Test + name: CRD CEL Validation Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -71,8 +70,7 @@ jobs: ~/go/pkg/mod ~/go/bin key: celvalidation-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }} - - name: Run unit tests - run: make test-cel + - run: make test-crdcel test_controller: if: github.event_name == 'pull_request' || github.event_name == 'push' @@ -91,8 +89,7 @@ jobs: ~/go/pkg/mod ~/go/bin key: controller-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }} - - name: Run unit tests - run: make test-controller + - run: make test-controller test_extproc: name: External Processor Test (Envoy ${{ matrix.name }}) @@ -133,8 +130,7 @@ jobs: docker run -v $ENVOY_BIN_DIR:/tmp/ci -w /tmp/ci \ --entrypoint /bin/cp ${{ matrix.envoy_version }} /usr/local/bin/envoy . echo $ENVOY_BIN_DIR >> $GITHUB_PATH - - name: Run unit tests - env: + - env: TEST_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_BEDROCK_USER_AWS_ACCESS_KEY_ID }} TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_BEDROCK_USER_AWS_SECRET_ACCESS_KEY }} TEST_OPENAI_API_KEY: ${{ secrets.ENVOY_AI_GATEWAY_OPENAI_API_KEY }} @@ -174,8 +170,7 @@ jobs: ~/go/bin key: e2e-test-${{ hashFiles('**/go.mod', '**/go.sum', '**/Makefile') }} - uses: docker/setup-buildx-action@v3 - - name: Run E2E tests - env: + - env: EG_VERSION: ${{ matrix.envoy_gateway_version }} TEST_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_BEDROCK_USER_AWS_ACCESS_KEY_ID }} TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_BEDROCK_USER_AWS_SECRET_ACCESS_KEY }} @@ -186,7 +181,7 @@ jobs: # Docker builds are verified in test_e2e job, so we only need to push the images when the event is a push event. if: github.event_name == 'push' name: Push Docker Images - needs: [unittest, test_cel_validation, test_controller, test_extproc, test_e2e] + needs: [unittest, test_crdcel, test_controller, test_extproc, test_e2e] uses: ./.github/workflows/docker_builds_template.yaml helm_push: @@ -203,6 +198,4 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Push Helm chart - run: | - make helm-push + - run: make helm-push diff --git a/Makefile b/Makefile index 9a0a584e6..8e94a7d54 100644 --- a/Makefile +++ b/Makefile @@ -32,12 +32,12 @@ help: @echo "All core targets needed for contributing:" @echo " precommit Run all necessary steps to prepare for a commit." @echo " test Run the unit tests for the codebase." - @echo " test-coverage Run the unit tests for the codebase with coverage check." - @echo " test-cel Run the integration tests of CEL validation rules in API definitions with envtest." + @echo " test-coverage Run the unit tests for the codebase with coverage check." + @echo " test-crdcel Run the integration tests of CEL validation in CRD definitions with envtest." @echo " This will be needed when changing API definitions." @echo " test-extproc Run the integration tests for extproc without controller or k8s at all." @echo " test-controller Run the integration tests for the controller with envtest." - @echo " test-e2e Run the end-to-end tests with a local kind cluster." + @echo " test-e2e Run the end-to-end tests with a local kind cluster." @echo "" @echo "For example, 'make precommit test' should be enough for initial iterations, and later 'make test-cel' etc. for the normal development cycle." @echo "Note that some cases run by test-e2e or test-extproc use credentials and these will be skipped when not available." @@ -48,7 +48,7 @@ help: .PHONY: lint lint: golangci-lint @echo "lint => ./..." - @$(GOLANGCI_LINT) run --build-tags==test_cel_validation,test_controller,test_extproc ./... + @$(GOLANGCI_LINT) run --build-tags==test_crdcel,test_controller,test_extproc ./... .PHONY: codespell CODESPELL_SKIP := $(shell cat .codespell.skip | tr \\n ',') @@ -124,15 +124,15 @@ test: ENVTEST_K8S_VERSIONS ?= 1.29.0 1.30.0 1.31.0 -# This runs the integration tests of CEL validation rules in API definitions. +# This runs the integration tests of CEL validation rules in CRD definitions. # # This requires the EnvTest binary to be built. -.PHONY: test-cel -test-cel: envtest apigen +.PHONY: test-crdcel +test-crdcel: envtest apigen @for k8sVersion in $(ENVTEST_K8S_VERSIONS); do \ echo "Run CEL Validation on k8s $$k8sVersion"; \ KUBEBUILDER_ASSETS="$$($(ENVTEST) use $$k8sVersion -p path)" \ - go test ./tests/cel-validation $(GO_TEST_ARGS) $(GO_TEST_E2E_ARGS) --tags test_cel_validation; \ + go test ./tests/crdcel $(GO_TEST_ARGS) $(GO_TEST_E2E_ARGS) --tags test_crdcel; \ done # This runs the end-to-end tests for extproc without controller or k8s at all. diff --git a/tests/cel-validation/main_test.go b/tests/crdcel/main_test.go similarity index 99% rename from tests/cel-validation/main_test.go rename to tests/crdcel/main_test.go index 7058c279e..a4554918d 100644 --- a/tests/cel-validation/main_test.go +++ b/tests/crdcel/main_test.go @@ -1,4 +1,4 @@ -//go:build test_cel_validation +//go:build test_crdcel package celvalidation diff --git a/tests/cel-validation/testdata/aigatewayroutes/basic.yaml b/tests/crdcel/testdata/aigatewayroutes/basic.yaml similarity index 100% rename from tests/cel-validation/testdata/aigatewayroutes/basic.yaml rename to tests/crdcel/testdata/aigatewayroutes/basic.yaml diff --git a/tests/cel-validation/testdata/aigatewayroutes/llmcosts.yaml b/tests/crdcel/testdata/aigatewayroutes/llmcosts.yaml similarity index 100% rename from tests/cel-validation/testdata/aigatewayroutes/llmcosts.yaml rename to tests/crdcel/testdata/aigatewayroutes/llmcosts.yaml diff --git a/tests/cel-validation/testdata/aigatewayroutes/no_target_refs.yaml b/tests/crdcel/testdata/aigatewayroutes/no_target_refs.yaml similarity index 100% rename from tests/cel-validation/testdata/aigatewayroutes/no_target_refs.yaml rename to tests/crdcel/testdata/aigatewayroutes/no_target_refs.yaml diff --git a/tests/cel-validation/testdata/aigatewayroutes/non_openai_schema.yaml b/tests/crdcel/testdata/aigatewayroutes/non_openai_schema.yaml similarity index 100% rename from tests/cel-validation/testdata/aigatewayroutes/non_openai_schema.yaml rename to tests/crdcel/testdata/aigatewayroutes/non_openai_schema.yaml diff --git a/tests/cel-validation/testdata/aigatewayroutes/unknown_schema.yaml b/tests/crdcel/testdata/aigatewayroutes/unknown_schema.yaml similarity index 100% rename from tests/cel-validation/testdata/aigatewayroutes/unknown_schema.yaml rename to tests/crdcel/testdata/aigatewayroutes/unknown_schema.yaml diff --git a/tests/cel-validation/testdata/aigatewayroutes/unsupported_match.yaml b/tests/crdcel/testdata/aigatewayroutes/unsupported_match.yaml similarity index 100% rename from tests/cel-validation/testdata/aigatewayroutes/unsupported_match.yaml rename to tests/crdcel/testdata/aigatewayroutes/unsupported_match.yaml diff --git a/tests/cel-validation/testdata/aiservicebackends/basic-eg-backend.yaml b/tests/crdcel/testdata/aiservicebackends/basic-eg-backend.yaml similarity index 100% rename from tests/cel-validation/testdata/aiservicebackends/basic-eg-backend.yaml rename to tests/crdcel/testdata/aiservicebackends/basic-eg-backend.yaml diff --git a/tests/cel-validation/testdata/aiservicebackends/basic.yaml b/tests/crdcel/testdata/aiservicebackends/basic.yaml similarity index 100% rename from tests/cel-validation/testdata/aiservicebackends/basic.yaml rename to tests/crdcel/testdata/aiservicebackends/basic.yaml diff --git a/tests/cel-validation/testdata/aiservicebackends/unknown_schema.yaml b/tests/crdcel/testdata/aiservicebackends/unknown_schema.yaml similarity index 100% rename from tests/cel-validation/testdata/aiservicebackends/unknown_schema.yaml rename to tests/crdcel/testdata/aiservicebackends/unknown_schema.yaml diff --git a/tests/cel-validation/testdata/backendsecuritypolicies/aws_credential_file.yaml b/tests/crdcel/testdata/backendsecuritypolicies/aws_credential_file.yaml similarity index 100% rename from tests/cel-validation/testdata/backendsecuritypolicies/aws_credential_file.yaml rename to tests/crdcel/testdata/backendsecuritypolicies/aws_credential_file.yaml diff --git a/tests/cel-validation/testdata/backendsecuritypolicies/aws_oidc.yaml b/tests/crdcel/testdata/backendsecuritypolicies/aws_oidc.yaml similarity index 100% rename from tests/cel-validation/testdata/backendsecuritypolicies/aws_oidc.yaml rename to tests/crdcel/testdata/backendsecuritypolicies/aws_oidc.yaml diff --git a/tests/cel-validation/testdata/backendsecuritypolicies/basic.yaml b/tests/crdcel/testdata/backendsecuritypolicies/basic.yaml similarity index 100% rename from tests/cel-validation/testdata/backendsecuritypolicies/basic.yaml rename to tests/crdcel/testdata/backendsecuritypolicies/basic.yaml diff --git a/tests/cel-validation/testdata/backendsecuritypolicies/missing_type.yaml b/tests/crdcel/testdata/backendsecuritypolicies/missing_type.yaml similarity index 100% rename from tests/cel-validation/testdata/backendsecuritypolicies/missing_type.yaml rename to tests/crdcel/testdata/backendsecuritypolicies/missing_type.yaml diff --git a/tests/cel-validation/testdata/backendsecuritypolicies/multiple_security_policies.yaml b/tests/crdcel/testdata/backendsecuritypolicies/multiple_security_policies.yaml similarity index 100% rename from tests/cel-validation/testdata/backendsecuritypolicies/multiple_security_policies.yaml rename to tests/crdcel/testdata/backendsecuritypolicies/multiple_security_policies.yaml diff --git a/tests/cel-validation/testdata/backendsecuritypolicies/unknown_provider.yaml b/tests/crdcel/testdata/backendsecuritypolicies/unknown_provider.yaml similarity index 100% rename from tests/cel-validation/testdata/backendsecuritypolicies/unknown_provider.yaml rename to tests/crdcel/testdata/backendsecuritypolicies/unknown_provider.yaml