Skip to content

Commit 8f85e7f

Browse files
authored
chore: add more conformance-test report for gateway-api (#2557)
1 parent 76c695c commit 8f85e7f

File tree

4 files changed

+35
-60
lines changed

4 files changed

+35
-60
lines changed

.github/workflows/apisix-conformance-test.yml

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,10 @@ permissions:
3535
pull-requests: write
3636

3737
jobs:
38-
prepare:
39-
name: Prepare
40-
runs-on: ubuntu-latest
41-
steps:
42-
- name: Checkout
43-
uses: actions/checkout@v4
44-
45-
- name: Setup Go Env
46-
id: go
47-
uses: actions/setup-go@v4
48-
with:
49-
go-version: "1.24"
50-
51-
- name: Install kind
52-
run: |
53-
go install sigs.k8s.io/[email protected]
54-
5538
conformance-test:
39+
env:
40+
CONFORMANCE_TEST_REPORT_OUTPUT: /tmp/apisix-ingress-controller-conformance-report.yaml
5641
timeout-minutes: 60
57-
needs:
58-
- prepare
5942
strategy:
6043
matrix:
6144
provider_type:
@@ -73,6 +56,10 @@ jobs:
7356
with:
7457
go-version: "1.24"
7558

59+
- name: Install kind
60+
run: |
61+
go install sigs.k8s.io/[email protected]
62+
7663
- name: Build images
7764
env:
7865
TAG: dev
@@ -107,24 +94,20 @@ jobs:
10794
env:
10895
PROVIDER_TYPE: ${{ matrix.provider_type }}
10996
run: |
110-
make conformance-test-standalone
97+
make conformance-test
11198
99+
- name: Show Conformance Report
100+
shell: bash
101+
run: |
102+
cat ${CONFORMANCE_TEST_REPORT_OUTPUT}
103+
112104
- name: Get Logs from apisix-ingress-controller
113105
shell: bash
114106
run: |
115107
kubectl logs -n apisix-conformance-test -l app=apisix-ingress-controller
116108
117109
- name: Upload Gateway API Conformance Report
118-
if: ${{ github.event_name == 'push' }}
119110
uses: actions/upload-artifact@v4
120111
with:
121112
name: apisix-ingress-controller-conformance-report-${{ matrix.provider_type }}.yaml
122-
path: apisix-ingress-controller-conformance-report.yaml
123-
124-
- name: Format Conformance Test Report
125-
if: ${{ github.event_name == 'pull_request' }}
126-
run: |
127-
echo '# conformance test report - ${{ matrix.provider_type }} mode' > report.md
128-
echo '```yaml' >> report.md
129-
cat apisix-ingress-controller-conformance-report.yaml >> report.md
130-
echo '```' >> report.md
113+
path: ${{ env.CONFORMANCE_TEST_REPORT_OUTPUT }}

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ IMG ?= apache/apisix-ingress-controller:$(IMAGE_TAG)
2727
ENVTEST_K8S_VERSION = 1.30.0
2828
KIND_NAME ?= apisix-ingress-cluster
2929

30-
GATEAY_API_VERSION ?= v1.3.0
3130
ADC_VERSION ?= 0.21.0
3231

32+
DIR := $(shell pwd)
33+
3334
GINKGO_VERSION ?= 2.20.0
3435
TEST_TIMEOUT ?= 80m
3536
TEST_DIR ?= ./test/e2e/apisix/
@@ -48,6 +49,14 @@ GITSHASYM="github.com/apache/apisix-ingress-controller/internal/version._buildGi
4849
BUILDOSSYM="github.com/apache/apisix-ingress-controller/internal/version._buildOS"
4950
GO_LDFLAGS ?= "-X=$(VERSYM)=$(VERSION) -X=$(GITSHASYM)=$(GITSHA) -X=$(BUILDOSSYM)=$(OSNAME)/$(OSARCH)"
5051

52+
# gateway-api
53+
GATEAY_API_VERSION ?= v1.3.0
54+
## https://github.com/kubernetes-sigs/gateway-api/blob/v1.3.0/pkg/features/httproute.go
55+
SUPPORTED_EXTENDED_FEATURES = "HTTPRouteDestinationPortMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteRequestMirror,HTTPRouteSchemeRedirect,GatewayAddressEmpty,HTTPRouteResponseHeaderModification,GatewayPort8080"
56+
CONFORMANCE_TEST_REPORT_OUTPUT ?= $(DIR)/apisix-ingress-controller-conformance-report.yaml
57+
## https://github.com/kubernetes-sigs/gateway-api/blob/v1.3.0/conformance/utils/suite/profiles.go
58+
CONFORMANCE_PROFILES ?= GATEWAY-HTTP
59+
5160
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
5261
ifeq (,$(shell go env GOBIN))
5362
GOBIN=$(shell go env GOPATH)/bin
@@ -139,11 +148,10 @@ install-ginkgo:
139148

140149
.PHONY: conformance-test
141150
conformance-test:
142-
go test -v ./test/conformance -tags=conformance -timeout 60m
143-
144-
.PHONY: conformance-test-standalone
145-
conformance-test-standalone:
146-
go test -v ./test/conformance/apisix -tags=conformance -timeout 60m
151+
go test -v ./test/conformance -tags conformance,experimental -timeout 60m \
152+
--supported-features=$(SUPPORTED_EXTENDED_FEATURES) \
153+
--conformance-profiles=$(CONFORMANCE_PROFILES) \
154+
--report-output=$(CONFORMANCE_TEST_REPORT_OUTPUT)
147155

148156
.PHONY: lint
149157
lint: sort-import golangci-lint ## Run golangci-lint linter

test/conformance/apisix/conformance_test.go renamed to test/conformance/conformance_test.go

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,60 +15,41 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
//go:build conformance
19-
// +build conformance
20-
2118
package conformance
2219

2320
import (
24-
"flag"
2521
"os"
2622
"testing"
2723

2824
"github.com/stretchr/testify/require"
29-
"k8s.io/apimachinery/pkg/util/sets"
3025
"sigs.k8s.io/gateway-api/conformance"
3126
conformancev1 "sigs.k8s.io/gateway-api/conformance/apis/v1"
3227
"sigs.k8s.io/gateway-api/conformance/tests"
28+
"sigs.k8s.io/gateway-api/conformance/utils/flags"
3329
"sigs.k8s.io/gateway-api/conformance/utils/suite"
34-
"sigs.k8s.io/gateway-api/pkg/features"
3530
"sigs.k8s.io/yaml"
3631
)
3732

33+
// https://github.com/kubernetes-sigs/gateway-api/blob/5c5fc388829d24e8071071b01e8313ada8f15d9f/conformance/utils/suite/suite.go#L358. SAN includes '*'
3834
var skippedTestsForSSL = []string{
39-
// Reason: https://github.com/kubernetes-sigs/gateway-api/blob/5c5fc388829d24e8071071b01e8313ada8f15d9f/conformance/utils/suite/suite.go#L358. SAN includes '*'
4035
tests.HTTPRouteHTTPSListener.ShortName,
4136
tests.HTTPRouteRedirectPortAndScheme.ShortName,
4237
}
4338

4439
// TODO: HTTPRoute hostname intersection and listener hostname matching
4540

46-
var gatewaySupportedFeatures = []features.FeatureName{
47-
features.SupportGateway,
48-
features.SupportHTTPRoute,
49-
// features.SupportHTTPRouteMethodMatching,
50-
// features.SupportHTTPRouteResponseHeaderModification,
51-
// features.SupportHTTPRouteRequestMirror,
52-
// features.SupportHTTPRouteBackendRequestHeaderModification,
53-
// features.SupportHTTPRouteHostRewrite,
54-
}
55-
5641
func TestGatewayAPIConformance(t *testing.T) {
57-
flag.Parse()
58-
5942
opts := conformance.DefaultOptions(t)
6043
opts.Debug = true
6144
opts.CleanupBaseResources = true
6245
opts.GatewayClassName = gatewayClassName
63-
opts.SupportedFeatures = sets.New(gatewaySupportedFeatures...)
6446
opts.SkipTests = skippedTestsForSSL
6547
opts.Implementation = conformancev1.Implementation{
6648
Organization: "APISIX",
6749
Project: "apisix-ingress-controller",
6850
URL: "https://github.com/apache/apisix-ingress-controller.git",
6951
Version: "v2.0.0",
7052
}
71-
opts.ConformanceProfiles = sets.New(suite.GatewayHTTPConformanceProfileName)
7253

7354
cSuite, err := suite.NewConformanceTestSuite(opts)
7455
require.NoError(t, err)
@@ -80,7 +61,6 @@ func TestGatewayAPIConformance(t *testing.T) {
8061
t.Fatalf("failed to run the gateway conformance test suite: %v", err)
8162
}
8263

83-
const reportFileName = "apisix-ingress-controller-conformance-report.yaml"
8464
report, err := cSuite.Report()
8565
if err != nil {
8666
t.Fatalf("failed to get the gateway conformance test report: %v", err)
@@ -90,6 +70,10 @@ func TestGatewayAPIConformance(t *testing.T) {
9070
if err != nil {
9171
t.Fatalf("failed to marshal the gateway conformance test report: %v", err)
9272
}
93-
// Save report in the root of the repository, file name is in .gitignore.
94-
require.NoError(t, os.WriteFile("../../../"+reportFileName, rawReport, 0o600))
73+
f, err := os.Create(*flags.ReportOutput)
74+
require.NoError(t, err)
75+
defer func() { _ = f.Close() }()
76+
77+
_, err = f.Write(rawReport)
78+
require.NoError(t, err)
9579
}

0 commit comments

Comments
 (0)