Skip to content

Commit

Permalink
chore: fixes CEL validation test target name (envoyproxy#300)
Browse files Browse the repository at this point in the history
**Commit Message**

This renames `make test-cel` to `make test-crdcel` to be precise
about what it is testing since we are also using CEL for LLM costs.

Also, this renames the tests/cel-validation directory to tests/crdcel
since it was previously incorrect and didn't match the make target.

---------

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Erica Hughberg <erica.sundberg.90@gmail.com>
  • Loading branch information
mathetake authored and missBerg committed Feb 9, 2025
1 parent 8bced8b commit 02bc8b4
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 25 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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 }})
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand All @@ -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:
Expand All @@ -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
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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 ',')
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build test_cel_validation
//go:build test_crdcel

package celvalidation

Expand Down

0 comments on commit 02bc8b4

Please sign in to comment.