This is an automated email from the ASF dual-hosted git repository. ronething pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push: new 03877e06 fix(ci): run e2e group by resource api group (#2431) 03877e06 is described below commit 03877e06abbdf8fda712c65a9f0f6613bdbf5f59 Author: Ashing Zheng <axing...@gmail.com> AuthorDate: Fri Jun 27 16:31:06 2025 +0800 fix(ci): run e2e group by resource api group (#2431) Signed-off-by: ashing <axing...@gmail.com> --- .github/workflows/apisix-conformance-test.yml | 2 +- .github/workflows/apisix-e2e-test.yml | 5 + Makefile | 2 +- config/rbac/gatewayproxy_editor_role.yaml | 31 ------ config/rbac/gatewayproxy_viewer_role.yaml | 27 ------ internal/provider/adc/executor.go | 6 +- test/e2e/apisix/basic.go | 2 +- test/e2e/apisix/consumer.go | 2 +- test/e2e/apisix/globalrule.go | 2 +- test/e2e/apisix/pluginconfig.go | 2 +- test/e2e/apisix/route.go | 2 +- test/e2e/apisix/tls.go | 2 +- test/e2e/crds/backendtrafficpolicy.go | 4 +- test/e2e/crds/consumer.go | 2 +- test/e2e/gatewayapi/controller.go | 2 +- test/e2e/gatewayapi/gateway.go | 2 +- test/e2e/gatewayapi/gatewayclass.go | 131 ++++++++++++++++++++++++++ test/e2e/gatewayapi/gatewayproxy.go | 2 +- test/e2e/gatewayapi/httproute.go | 2 +- test/e2e/ingress/ingress.go | 2 +- 20 files changed, 155 insertions(+), 77 deletions(-) diff --git a/.github/workflows/apisix-conformance-test.yml b/.github/workflows/apisix-conformance-test.yml index 2b65eb31..4b23f303 100644 --- a/.github/workflows/apisix-conformance-test.yml +++ b/.github/workflows/apisix-conformance-test.yml @@ -122,7 +122,7 @@ jobs: - name: Format Conformance Test Report if: ${{ github.event_name == 'pull_request' }} run: | - echo '# conformance test report' > report.md + echo '# conformance test report - ${{ matrix.provider_type }} mode' > report.md echo '```yaml' >> report.md cat apisix-ingress-controller-conformance-report.yaml >> report.md echo '```' >> report.md diff --git a/.github/workflows/apisix-e2e-test.yml b/.github/workflows/apisix-e2e-test.yml index a193015c..41e6ff51 100644 --- a/.github/workflows/apisix-e2e-test.yml +++ b/.github/workflows/apisix-e2e-test.yml @@ -57,6 +57,10 @@ jobs: provider_type: - apisix-standalone - apisix + cases_subset: + - apisix.apache.org + - networking.k8s.io + fail-fast: false runs-on: ubuntu-latest steps: - name: Checkout @@ -106,5 +110,6 @@ jobs: env: TEST_DIR: "./test/e2e/apisix/" PROVIDER_TYPE: ${{ matrix.provider_type }} + TEST_LABEL: ${{ matrix.cases_subset }} run: | make e2e-test diff --git a/Makefile b/Makefile index 8c29e4f0..5425b63f 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,7 @@ kind-e2e-test: kind-up build-image kind-load-images e2e-test .PHONY: e2e-test e2e-test: @kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG - go test $(TEST_DIR) -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)" + go test $(TEST_DIR) -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)" -ginkgo.label-filter="$(TEST_LABEL)" .PHONY: conformance-test conformance-test: diff --git a/config/rbac/gatewayproxy_editor_role.yaml b/config/rbac/gatewayproxy_editor_role.yaml deleted file mode 100644 index 7ea08d91..00000000 --- a/config/rbac/gatewayproxy_editor_role.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# permissions for end users to edit gatewayproxies. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: gatewayproxy-editor-role - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: apisix-ingress-controller - app.kubernetes.io/part-of: apisix-ingress-controller - app.kubernetes.io/managed-by: kustomize - name: gatewayproxy-editor-role -rules: -- apiGroups: - - apisix.apache.org - resources: - - gatewayproxies - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - apisix.apache.org - resources: - - gatewayproxies/status - verbs: - - get diff --git a/config/rbac/gatewayproxy_viewer_role.yaml b/config/rbac/gatewayproxy_viewer_role.yaml deleted file mode 100644 index 75ae4255..00000000 --- a/config/rbac/gatewayproxy_viewer_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to view gatewayproxies. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: gatewayproxy-viewer-role - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: apisix-ingress-controller - app.kubernetes.io/part-of: apisix-ingress-controller - app.kubernetes.io/managed-by: kustomize - name: gatewayproxy-viewer-role -rules: -- apiGroups: - - apisix.apache.org - resources: - - gatewayproxies - verbs: - - get - - list - - watch -- apiGroups: - - apisix.apache.org - resources: - - gatewayproxies/status - verbs: - - get diff --git a/internal/provider/adc/executor.go b/internal/provider/adc/executor.go index e931f56e..304739e2 100644 --- a/internal/provider/adc/executor.go +++ b/internal/provider/adc/executor.go @@ -117,9 +117,9 @@ func (e *DefaultADCExecutor) buildCmdError(runErr error, stdout, stderr []byte) func (e *DefaultADCExecutor) handleOutput(output []byte) error { var result adctypes.SyncResult - if index := strings.IndexByte(string(output), '{'); index > 0 { - log.Warnf("extra output: %s", string(output[:index])) - output = output[index:] + log.Debugf("adc output: %s", string(output)) + if lines := bytes.Split(output, []byte{'\n'}); len(lines) > 0 { + output = lines[len(lines)-1] } if err := json.Unmarshal(output, &result); err != nil { log.Errorw("failed to unmarshal adc output", diff --git a/test/e2e/apisix/basic.go b/test/e2e/apisix/basic.go index 9a28281f..245419f1 100644 --- a/test/e2e/apisix/basic.go +++ b/test/e2e/apisix/basic.go @@ -24,7 +24,7 @@ import ( "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" ) -var _ = Describe("APISIX Standalone Basic Tests", func() { +var _ = Describe("APISIX Standalone Basic Tests", Label("apisix.apache.org", "v2", "basic"), func() { s := scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", }) diff --git a/test/e2e/apisix/consumer.go b/test/e2e/apisix/consumer.go index bc5b1194..29ceb667 100644 --- a/test/e2e/apisix/consumer.go +++ b/test/e2e/apisix/consumer.go @@ -33,7 +33,7 @@ import ( type Headers map[string]string -var _ = Describe("Test ApisixConsumer", func() { +var _ = Describe("Test ApisixConsumer", Label("apisix.apache.org", "v2", "apisixconsumer"), func() { var ( s = scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", diff --git a/test/e2e/apisix/globalrule.go b/test/e2e/apisix/globalrule.go index 491885ea..0e3f2f41 100644 --- a/test/e2e/apisix/globalrule.go +++ b/test/e2e/apisix/globalrule.go @@ -61,7 +61,7 @@ spec: scope: "Namespace" ` -var _ = Describe("Test GlobalRule", func() { +var _ = Describe("Test GlobalRule", Label("apisix.apache.org", "v2", "apisixglobalrule"), func() { s := scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", }) diff --git a/test/e2e/apisix/pluginconfig.go b/test/e2e/apisix/pluginconfig.go index 0f96b253..2c4c27fc 100644 --- a/test/e2e/apisix/pluginconfig.go +++ b/test/e2e/apisix/pluginconfig.go @@ -64,7 +64,7 @@ spec: scope: "Namespace" ` -var _ = Describe("Test ApisixPluginConfig", func() { +var _ = Describe("Test ApisixPluginConfig", Label("apisix.apache.org", "v2", "apisixpluginconfig"), func() { var ( s = scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", diff --git a/test/e2e/apisix/route.go b/test/e2e/apisix/route.go index 5c18e62c..12940bd0 100644 --- a/test/e2e/apisix/route.go +++ b/test/e2e/apisix/route.go @@ -32,7 +32,7 @@ import ( "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" ) -var _ = Describe("Test ApisixRoute", func() { +var _ = Describe("Test ApisixRoute", Label("apisix.apache.org", "v2", "apisixroute"), func() { var ( s = scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", diff --git a/test/e2e/apisix/tls.go b/test/e2e/apisix/tls.go index e5870421..b81020b4 100644 --- a/test/e2e/apisix/tls.go +++ b/test/e2e/apisix/tls.go @@ -90,7 +90,7 @@ var Cert = strings.TrimSpace(framework.TestServerCert) var Key = strings.TrimSpace(framework.TestServerKey) -var _ = Describe("Test ApisixTls", func() { +var _ = Describe("Test ApisixTls", Label("apisix.apache.org", "v2", "apisixtls"), func() { var ( s = scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", diff --git a/test/e2e/crds/backendtrafficpolicy.go b/test/e2e/crds/backendtrafficpolicy.go index 3e2ea104..4dc2ca92 100644 --- a/test/e2e/crds/backendtrafficpolicy.go +++ b/test/e2e/crds/backendtrafficpolicy.go @@ -27,7 +27,7 @@ import ( "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" ) -var _ = Describe("Test BackendTrafficPolicy base on HTTPRoute", func() { +var _ = Describe("Test BackendTrafficPolicy base on HTTPRoute", Label("apisix.apache.org", "v1alpha1", "backendtrafficpolicy"), func() { s := scaffold.NewDefaultScaffold() var defaultGatewayProxy = ` @@ -161,7 +161,7 @@ spec: }) }) -var _ = Describe("Test BackendTrafficPolicy base on Ingress", func() { +var _ = Describe("Test BackendTrafficPolicy base on Ingress", Label("apisix.apache.org", "v1alpha1", "backendtrafficpolicy"), func() { s := scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", }) diff --git a/test/e2e/crds/consumer.go b/test/e2e/crds/consumer.go index 6f773ed1..879d6048 100644 --- a/test/e2e/crds/consumer.go +++ b/test/e2e/crds/consumer.go @@ -28,7 +28,7 @@ import ( "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" ) -var _ = Describe("Test Consumer", func() { +var _ = Describe("Test Consumer", Label("apisix.apache.org", "v1alpha1", "consumer"), func() { s := scaffold.NewDefaultScaffold() var defaultGatewayProxy = ` diff --git a/test/e2e/gatewayapi/controller.go b/test/e2e/gatewayapi/controller.go index 03f13606..d2a7bdd0 100644 --- a/test/e2e/gatewayapi/controller.go +++ b/test/e2e/gatewayapi/controller.go @@ -28,7 +28,7 @@ import ( "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" ) -var _ = Describe("Check if controller cache gets synced with correct resources", func() { +var _ = Describe("Check if controller cache gets synced with correct resources", Label("networking.k8s.io", "basic"), func() { var gatewayProxyYaml = ` apiVersion: apisix.apache.org/v1alpha1 diff --git a/test/e2e/gatewayapi/gateway.go b/test/e2e/gatewayapi/gateway.go index 982a52e1..28b1c900 100644 --- a/test/e2e/gatewayapi/gateway.go +++ b/test/e2e/gatewayapi/gateway.go @@ -42,7 +42,7 @@ func createSecret(s *scaffold.Scaffold, secretName string) { assert.Nil(GinkgoT(), err, "create secret error") } -var _ = Describe("Test Gateway", func() { +var _ = Describe("Test Gateway", Label("networking.k8s.io", "gateway"), func() { s := scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", }) diff --git a/test/e2e/gatewayapi/gatewayclass.go b/test/e2e/gatewayapi/gatewayclass.go new file mode 100644 index 00000000..b8eae0ce --- /dev/null +++ b/test/e2e/gatewayapi/gatewayclass.go @@ -0,0 +1,131 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package gatewayapi + +import ( + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" +) + +var _ = Describe("Test GatewayClass", Label("networking.k8s.io", "gatewayclass"), func() { + s := scaffold.NewScaffold(&scaffold.Options{ + ControllerName: "apisix.apache.org/apisix-ingress-controller", + }) + + Context("Create GatewayClass", func() { + var defautlGatewayClass = ` +apiVersion: gateway.networking.k8s.io/v1 +kind: GatewayClass +metadata: + name: apisix +spec: + controllerName: "apisix.apache.org/apisix-ingress-controller" +` + + var noGatewayClass = ` +apiVersion: gateway.networking.k8s.io/v1 +kind: GatewayClass +metadata: + name: apisix-not-accepeted +spec: + controllerName: "apisix.apache.org/not-exist" +` + const defaultGateway = ` +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: apisix +spec: + gatewayClassName: apisix + listeners: + - name: http1 + protocol: HTTP + port: 80 +` + It("Create GatewayClass", func() { + By("create default GatewayClass") + err := s.CreateResourceFromStringWithNamespace(defautlGatewayClass, "") + Expect(err).NotTo(HaveOccurred(), "creating GatewayClass") + time.Sleep(5 * time.Second) + + gcyaml, err := s.GetResourceYaml("GatewayClass", "apisix") + Expect(err).NotTo(HaveOccurred(), "getting GatewayClass yaml") + Expect(gcyaml).To(ContainSubstring(`status: "True"`), "checking GatewayClass condition status") + Expect(gcyaml).To(ContainSubstring("message: the gatewayclass has been accepted by the apisix-ingress-controller"), "checking GatewayClass condition message") + + By("create GatewayClass with not accepted") + err = s.CreateResourceFromStringWithNamespace(noGatewayClass, "") + Expect(err).NotTo(HaveOccurred(), "creating GatewayClass") + time.Sleep(5 * time.Second) + + gcyaml, err = s.GetResourceYaml("GatewayClass", "apisix-not-accepeted") + Expect(err).NotTo(HaveOccurred(), "getting GatewayClass yaml") + Expect(gcyaml).To(ContainSubstring(`status: Unknown`), "checking GatewayClass condition status") + Expect(gcyaml).To(ContainSubstring("message: Waiting for controller"), "checking GatewayClass condition message") + }) + + It("Delete GatewayClass", func() { + By("create default GatewayClass") + err := s.CreateResourceFromStringWithNamespace(defautlGatewayClass, "") + Expect(err).NotTo(HaveOccurred(), "creating GatewayClass") + Eventually(func() string { + spec, err := s.GetResourceYaml("GatewayClass", "apisix") + Expect(err).NotTo(HaveOccurred(), "get resource yaml") + return spec + }).WithTimeout(8 * time.Second).ProbeEvery(time.Second).Should(ContainSubstring(`status: "True"`)) + + By("create a Gateway") + err = s.CreateResourceFromStringWithNamespace(defaultGateway, s.Namespace()) + Expect(err).NotTo(HaveOccurred(), "creating Gateway") + time.Sleep(time.Second) + + By("try to delete the GatewayClass") + _, err = s.RunKubectlAndGetOutput("delete", "GatewayClass", "apisix", "--wait=false") + Expect(err).NotTo(HaveOccurred()) + + _, err = s.GetResourceYaml("GatewayClass", "apisix") + Expect(err).NotTo(HaveOccurred(), "get resource yaml") + + output, err := s.RunKubectlAndGetOutput("describe", "GatewayClass", "apisix") + Expect(err).NotTo(HaveOccurred(), "describe GatewayClass apisix") + Expect(output).To(And( + ContainSubstring("Warning"), + ContainSubstring("DeletionBlocked"), + ContainSubstring("gatewayclass-controller"), + ContainSubstring("the GatewayClass is still used by Gateways"), + )) + + By("delete the Gateway") + err = s.DeleteResource("Gateway", "apisix") + Expect(err).NotTo(HaveOccurred(), "deleting Gateway") + time.Sleep(time.Second) + + By("try to delete the GatewayClass again") + err = s.DeleteResource("GatewayClass", "apisix") + Expect(err).NotTo(HaveOccurred()) + + _, err = s.GetResourceYaml("GatewayClass", "apisix") + Expect(err).To(HaveOccurred(), "get resource yaml") + Expect(err.Error()).To(ContainSubstring("not found")) + }) + }) +}) diff --git a/test/e2e/gatewayapi/gatewayproxy.go b/test/e2e/gatewayapi/gatewayproxy.go index 284757e9..d18755c9 100644 --- a/test/e2e/gatewayapi/gatewayproxy.go +++ b/test/e2e/gatewayapi/gatewayproxy.go @@ -28,7 +28,7 @@ import ( "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" ) -var _ = Describe("Test GatewayProxy", func() { +var _ = Describe("Test GatewayProxy", Label("apisix.apache.org", "v1alpha1", "gatewayproxy"), func() { s := scaffold.NewDefaultScaffold() var defaultGatewayClass = ` diff --git a/test/e2e/gatewayapi/httproute.go b/test/e2e/gatewayapi/httproute.go index 4239b2f6..5b9afd37 100644 --- a/test/e2e/gatewayapi/httproute.go +++ b/test/e2e/gatewayapi/httproute.go @@ -38,7 +38,7 @@ import ( "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" ) -var _ = Describe("Test HTTPRoute", func() { +var _ = Describe("Test HTTPRoute", Label("networking.k8s.io", "httproute"), func() { s := scaffold.NewDefaultScaffold() var gatewayProxyYaml = ` diff --git a/test/e2e/ingress/ingress.go b/test/e2e/ingress/ingress.go index d6368e98..0c85c532 100644 --- a/test/e2e/ingress/ingress.go +++ b/test/e2e/ingress/ingress.go @@ -46,7 +46,7 @@ func createSecret(s *scaffold.Scaffold, secretName string) { assert.Nil(GinkgoT(), err, "create secret error") } -var _ = Describe("Test Ingress", func() { +var _ = Describe("Test Ingress", Label("networking.k8s.io", "ingress"), func() { s := scaffold.NewScaffold(&scaffold.Options{ ControllerName: "apisix.apache.org/apisix-ingress-controller", })