Skip to content

Commit

Permalink
Moves gw api env var to Setup test env step
Browse files Browse the repository at this point in the history
Signed-off-by: Daneyon Hansen <[email protected]>
  • Loading branch information
danehans committed Dec 16, 2024
1 parent 9dae4d1 commit 3b413a0
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/.env/pr-tests/max_versions.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
k8sgateway_api_version='v1.2.0'
k8sgateway_api_version='v1.2.1'
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ runs:
CLUSTER_NODE_VERSION: ${{ matrix.kube-version.node }}
IMAGE_VARIANT: ${{ matrix.image-variant }}
CONFORMANCE: "true"
CONFORMANCE_VERSION: ${{ inputs.k8sgateway-api-version }}
run: ./ci/kind/setup-kind.sh
- name: Install Gloo Gateway with the k8s gateway integration enabled
shell: bash
Expand All @@ -57,9 +58,9 @@ runs:
fi
- name: Run the kubernetes gateway API conformance tests
shell: bash
env:
GATEWAY_API_VERSION: ${{ inputs.k8sgateway-api-version }}
run: make conformance
env:
CONFORMANCE_VERSION: ${{ inputs.k8sgateway-api-version }}
- name: Capture debug information when tests fail
if: ${{ failure() }}
shell: bash
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/nightly-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,15 @@ jobs:
- uses: actions/checkout@v4
with:
ref: main
- name: Dotenv Action
uses: falti/[email protected]
id: dotenv
with:
path: ${{ matrix.version-files.file }}
log-variables: true
- uses: ./.github/workflows/composite-actions/kube-gateway-api-conformance-tests
with:
k8sgateway-api-version: ${{ steps.dotenv.outputs.k8sgateway_api_version }}

kube_gateway_api_conformance_tests_18:
name: Conformance (branch=v1.18.x, type=Kubernetes Gateway API, version=${{matrix.kube-version.node}} )
Expand All @@ -507,8 +515,15 @@ jobs:
- uses: actions/checkout@v4
with:
ref: v1.18.x
- name: Dotenv Action
uses: falti/[email protected]
id: dotenv
with:
path: ${{ matrix.version-files.file }}
log-variables: true
- uses: ./.github/workflows/composite-actions/kube-gateway-api-conformance-tests

with:
k8sgateway-api-version: ${{ steps.dotenv.outputs.k8sgateway_api_version }}

kube_gateway_api_conformance_tests_17:
name: Conformance (branch=v1.17.x, type=Kubernetes Gateway API, version=${{matrix.kube-version.node}} )
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/regression-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,29 @@ jobs:
# (see https://github.com/solo-io/solo-projects/issues/6094)
image-variant:
- standard
version-files:
- label: 'min'
file: './.github/workflows/.env/pr-tests/min_versions.env'
- label: 'max'
file: './.github/workflows/.env/pr-tests/max_versions.env'
steps:
# Checkout the branch that initiated the action
- uses: actions/checkout@v4
- id: auto-succeed-tests
if: needs.prepare_env.outputs.should-auto-succeed-regression-tests == 'true'
run: |
echo "Kubernetes Gateway API conformance tests auto-succeeded"
# The dotenv action is used to load key-value pairs from files.
# In this case, the file is specified in the matrix and will contain the versions of the tools to use
- name: Dotenv Action
uses: falti/[email protected]
id: dotenv
with:
path: ${{ matrix.version-files.file }}
log-variables: true
# Run the k8s gateway api conformance tests
- id: run-tests
if: needs.prepare_env.outputs.should-auto-succeed-regression-tests != 'true'
uses: ./.github/workflows/composite-actions/kube-gateway-api-conformance-tests
with:
k8sgateway-api-version: ${{ steps.dotenv.outputs.k8sgateway_api_version }}
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ TEST_ASSET_DIR ?= $(ROOTDIR)/_test
# Directory to store downloaded conformance tests for different versions
CONFORMANCE_DIR ?= $(TEST_ASSET_DIR)/conformance
# Gateway API version used for conformance testing
GATEWAY_API_VERSION ?= v1.2.0
CONFORMANCE_VERSION ?= v1.2.0
# Fetch the module directory for the specified version of the Gateway API
GATEWAY_API_MODULE_DIR := $(shell go list -m -json sigs.k8s.io/gateway-api@$(GATEWAY_API_VERSION) | jq -r '.Dir')
GATEWAY_API_MODULE_DIR := $(shell go mod download -json sigs.k8s.io/gateway-api@$(CONFORMANCE_VERSION) | jq -r '.Dir')

# This is the location where assets are placed after a test failure
# This is used by our e2e tests to emit information about the running instance of Gloo Gateway
Expand Down Expand Up @@ -1244,14 +1244,14 @@ build-test-chart: ## Build the Helm chart and place it in the _test directory
#----------------------------------------------------------------------------------

# Download and prepare the conformance test suite for a specific Gateway API version
$(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/conformance_test.go:
mkdir -p $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)
go mod download sigs.k8s.io/gateway-api@$(GATEWAY_API_VERSION)
$(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/conformance_test.go:
mkdir -p $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)
go mod download sigs.k8s.io/gateway-api@$(CONFORMANCE_VERSION)
cp $(GATEWAY_API_MODULE_DIR)/conformance/conformance_test.go $@

# Install the correct version of Gateway API CRDs in the Kubernetes cluster
install-crds:
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/$(GATEWAY_API_VERSION)/experimental-install.yaml
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/$(CONFORMANCE_VERSION)/experimental-install.yaml

# Update go.mod to replace Gateway API module with the version used for conformance testing
update-mod:
Expand All @@ -1265,18 +1265,18 @@ reset-mod:
# Common arguments for conformance testing
CONFORMANCE_SUPPORTED_FEATURES ?= -supported-features=Gateway,ReferenceGrant,HTTPRoute,HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRouteResponseHeaderModification,HTTPRoutePortRedirect,HTTPRouteHostRewrite,HTTPRouteSchemeRedirect,HTTPRoutePathRedirect,HTTPRouteHostRewrite,HTTPRoutePathRewrite,HTTPRouteRequestMirror
CONFORMANCE_SUPPORTED_PROFILES ?= -conformance-profiles=GATEWAY-HTTP
CONFORMANCE_REPORT_ARGS ?= -report-output=$(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/$(VERSION)-report.yaml -organization=solo.io -project=gloo-gateway -version=$(VERSION) -url=github.com/solo-io/gloo -contact=github.com/solo-io/gloo/issues/new/choose
CONFORMANCE_REPORT_ARGS ?= -report-output=$(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/$(VERSION)-report.yaml -organization=solo.io -project=gloo-gateway -version=$(VERSION) -url=github.com/solo-io/gloo -contact=github.com/solo-io/gloo/issues/new/choose
CONFORMANCE_ARGS := -gateway-class=gloo-gateway $(CONFORMANCE_SUPPORTED_FEATURES) $(CONFORMANCE_SUPPORTED_PROFILES) $(CONFORMANCE_REPORT_ARGS)

# Run conformance tests for the specified Gateway API version
.PHONY: conformance
conformance: $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/conformance_test.go install-crds update-mod
conformance: $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/conformance_test.go install-crds update-mod
@trap "make reset-mod" EXIT; \
go test -mod=mod -ldflags=$(LDFLAGS) -tags conformance -test.v $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/... -args $(CONFORMANCE_ARGS)
go test -mod=mod -ldflags=$(LDFLAGS) -tags conformance -test.v $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/... -args $(CONFORMANCE_ARGS)

.PHONY: conformance-% ## Run the conformance test suite
conformance-%: $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/conformance_test.go
go test -mod=mod -ldflags=$(LDFLAGS) -tags conformance -test.v $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/... -args $(CONFORMANCE_ARGS) \
conformance-%: $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/conformance_test.go
go test -mod=mod -ldflags=$(LDFLAGS) -tags conformance -test.v $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/... -args $(CONFORMANCE_ARGS) \
-run-test=$*

#----------------------------------------------------------------------------------
Expand Down
File renamed without changes.

0 comments on commit 3b413a0

Please sign in to comment.