diff --git a/.github/workflows/e2e-test-ci.yml b/.github/workflows/e2e-test-ci.yml index 1185cd0ab..b9e7a97fa 100644 --- a/.github/workflows/e2e-test-ci.yml +++ b/.github/workflows/e2e-test-ci.yml @@ -34,8 +34,7 @@ concurrency: jobs: changes: - if: | - contains(github.event.pull_request.labels.*.name, 'ci-e2e-test') + if: contains(github.event.pull_request.labels.*.name, 'ci-e2e-test') runs-on: buildjet-2vcpu-ubuntu-2204 outputs: docs: ${{ steps.filter.outputs.docs }} diff --git a/.github/workflows/unit-test-ci.yml b/.github/workflows/unit-test-ci.yml index b084afdab..ca2f70ea2 100644 --- a/.github/workflows/unit-test-ci.yml +++ b/.github/workflows/unit-test-ci.yml @@ -28,8 +28,7 @@ on: - release/1.8 jobs: changes: - if: | - contains(github.event.pull_request.labels.*.name, 'ci-unit-test') + if: contains(github.event.pull_request.labels.*.name, 'ci-unit-test') runs-on: ubuntu-latest outputs: docs: ${{ steps.filter.outputs.docs }} diff --git a/test/e2e/scaffold/k8s.go b/test/e2e/scaffold/k8s.go index 8729de5cc..c32888f0d 100644 --- a/test/e2e/scaffold/k8s.go +++ b/test/e2e/scaffold/k8s.go @@ -28,6 +28,7 @@ import ( "time" "github.com/api7/api7-ingress-controller/pkg/apisix" + v2 "github.com/api7/api7-ingress-controller/pkg/kube/apisix/apis/config/v2" "github.com/api7/api7-ingress-controller/pkg/log" "github.com/api7/api7-ingress-controller/pkg/metrics" v1 "github.com/api7/api7-ingress-controller/pkg/types/apisix/v1" @@ -820,3 +821,25 @@ func (s *Scaffold) RunDigDNSClientFromK8s(args ...string) (string, error) { kubectlArgs = append(kubectlArgs, args...) return s.RunKubectlAndGetOutput(kubectlArgs...) } + +func (s *Scaffold) GetApisixResourceStatus(resourceName string, resourceType string) (*v2.ApisixStatus, error) { + kubectlArgs := []string{ + "get", resourceType, resourceName, "-o", "json", + } + output, err := s.RunKubectlAndGetOutput(kubectlArgs...) + if err != nil { + return nil, err + } + var upstream v2.ApisixUpstream + err = json.Unmarshal([]byte(output), &upstream) + if err != nil { + return nil, err + } + return &upstream.Status, nil +} + +func (s *Scaffold) AssertCRSync(resourceName, resourceType, message string) { + routeStatus, err := s.GetApisixResourceStatus(resourceName, resourceType) + assert.Nil(ginkgo.GinkgoT(), err) + assert.Equal(ginkgo.GinkgoT(), message, routeStatus.Conditions[0].Message) +} diff --git a/test/e2e/suite-annotations/authorization.go b/test/e2e/suite-annotations/authorization.go index 95856ddcc..9b5b4bdba 100644 --- a/test/e2e/suite-annotations/authorization.go +++ b/test/e2e/suite-annotations/authorization.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: authorization annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: authorization annotations", func() { suites := func(scaffoldFunc func() *scaffold.Scaffold) { s := scaffoldFunc() diff --git a/test/e2e/suite-annotations/cors.go b/test/e2e/suite-annotations/cors.go index dd3e143ad..2b58bbca4 100644 --- a/test/e2e/suite-annotations/cors.go +++ b/test/e2e/suite-annotations/cors.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: cors annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: cors annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable in ingress networking/v1", func() { diff --git a/test/e2e/suite-annotations/csrf.go b/test/e2e/suite-annotations/csrf.go index 39bbaff34..fe22ae539 100644 --- a/test/e2e/suite-annotations/csrf.go +++ b/test/e2e/suite-annotations/csrf.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: csrf annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: csrf annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable csrf in ingress networking/v1", func() { diff --git a/test/e2e/suite-annotations/forward_auth.go b/test/e2e/suite-annotations/forward_auth.go index 9b5cece5f..f5c5d1677 100644 --- a/test/e2e/suite-annotations/forward_auth.go +++ b/test/e2e/suite-annotations/forward_auth.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: froward-auth annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: froward-auth annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.JustBeforeEach(func() { diff --git a/test/e2e/suite-annotations/http_method.go b/test/e2e/suite-annotations/http_method.go index 1244ed05d..57d6aeab2 100644 --- a/test/e2e/suite-annotations/http_method.go +++ b/test/e2e/suite-annotations/http_method.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: allow-http-methods annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: allow-http-methods annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable in ingress networking/v1", func() { @@ -101,7 +101,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-annotations: blocklist-http-methods annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: blocklist-http-methods annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable in ingress networking/v1", func() { diff --git a/test/e2e/suite-annotations/iprestriction.go b/test/e2e/suite-annotations/iprestriction.go index 5b26f60f2..7fb65328b 100644 --- a/test/e2e/suite-annotations/iprestriction.go +++ b/test/e2e/suite-annotations/iprestriction.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: allowlist-source-range annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: allowlist-source-range annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable in ingress networking/v1", func() { @@ -89,7 +89,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-annotations: blocklist-source-range annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: blocklist-source-range annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable in ingress networking/v1", func() { diff --git a/test/e2e/suite-annotations/plugin_conifg.go b/test/e2e/suite-annotations/plugin_conifg.go index 02693ebd9..d90a5f1e0 100644 --- a/test/e2e/suite-annotations/plugin_conifg.go +++ b/test/e2e/suite-annotations/plugin_conifg.go @@ -75,7 +75,7 @@ func _assert(s *scaffold.Scaffold, ing string) { resp.Body().Contains("This is the epilogue") } -var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1 with ApisixPluginConfig", func() { +var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1 with ApisixPluginConfig", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("networking/v1", func() { backendSvc, backendPorts := s.DefaultHTTPBackend() @@ -106,7 +106,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1beta1 with ApisixPluginConfig", func() { +var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1beta1 with ApisixPluginConfig", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("networking/v1beta1", func() { _createAPC(s) diff --git a/test/e2e/suite-annotations/redirect.go b/test/e2e/suite-annotations/redirect.go index 6267f08e2..902a7d648 100644 --- a/test/e2e/suite-annotations/redirect.go +++ b/test/e2e/suite-annotations/redirect.go @@ -26,7 +26,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: redirect annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: redirect annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("redirect http-to-https in ingress networking/v1", func() { diff --git a/test/e2e/suite-annotations/response_rewrite.go b/test/e2e/suite-annotations/response_rewrite.go index 2d07350a2..520d2d8c1 100644 --- a/test/e2e/suite-annotations/response_rewrite.go +++ b/test/e2e/suite-annotations/response_rewrite.go @@ -26,7 +26,7 @@ import ( ) // suite-annotations: response-rewrite annotations -var _ = ginkgo.Describe("suite-annotations: response-rewrite", func() { +var _ = ginkgo.PDescribe("suite-annotations: response-rewrite", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable in ingress networking/v1", func() { diff --git a/test/e2e/suite-annotations/rewrite.go b/test/e2e/suite-annotations/rewrite.go index 8f8e08131..46b7192b7 100644 --- a/test/e2e/suite-annotations/rewrite.go +++ b/test/e2e/suite-annotations/rewrite.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: rewrite annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: rewrite annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable in ingress networking/v1", func() { @@ -89,7 +89,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-annotations: rewrite regex annotations", func() { +var _ = ginkgo.PDescribe("suite-annotations: rewrite regex annotations", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("enable in ingress networking/v1", func() { diff --git a/test/e2e/suite-annotations/svc_namespace.go b/test/e2e/suite-annotations/svc_namespace.go index 2a99223d6..c08975c00 100644 --- a/test/e2e/suite-annotations/svc_namespace.go +++ b/test/e2e/suite-annotations/svc_namespace.go @@ -27,7 +27,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: svc-namespace annotations reference service in the same namespace", func() { +var _ = ginkgo.PDescribe("suite-annotations: svc-namespace annotations reference service in the same namespace", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("networking/v1", func() { @@ -108,7 +108,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-annotations: svc-namespace annotations cross-namespace reference service", func() { +var _ = ginkgo.PDescribe("suite-annotations: svc-namespace annotations cross-namespace reference service", func() { s := scaffold.NewDefaultScaffold() createNamespace := func(namespace string, watch string) { diff --git a/test/e2e/suite-annotations/upstreamprotocol.go b/test/e2e/suite-annotations/upstreamprotocol.go index d39695690..b5e01e530 100644 --- a/test/e2e/suite-annotations/upstreamprotocol.go +++ b/test/e2e/suite-annotations/upstreamprotocol.go @@ -24,7 +24,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1 upstream scheme", func() { +var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1 upstream scheme", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("sanity", func() { ing := ` @@ -59,7 +59,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-annotations-error: annotations.networking/v1 upstream scheme error", func() { +var _ = ginkgo.PDescribe("suite-annotations-error: annotations.networking/v1 upstream scheme error", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("sanity", func() { ing := ` @@ -94,7 +94,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1beta1 upstream scheme", func() { +var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1beta1 upstream scheme", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("sanity", func() { ing := ` diff --git a/test/e2e/suite-annotations/upstreamretry.go b/test/e2e/suite-annotations/upstreamretry.go index 939d6d58b..f6fa4e1e1 100644 --- a/test/e2e/suite-annotations/upstreamretry.go +++ b/test/e2e/suite-annotations/upstreamretry.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1 upstream", func() { +var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1 upstream", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("Test timeout: 1 retry and long timeout", func() { ing := ` diff --git a/test/e2e/suite-annotations/websocket.go b/test/e2e/suite-annotations/websocket.go index 0479fb4e2..994a8afe5 100644 --- a/test/e2e/suite-annotations/websocket.go +++ b/test/e2e/suite-annotations/websocket.go @@ -27,7 +27,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1 websocket", func() { +var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1 websocket", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("sanity", func() { resources := ` @@ -113,7 +113,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-annotations: annotations.networking/v1beta1 with websocket", func() { +var _ = ginkgo.PDescribe("suite-annotations: annotations.networking/v1beta1 with websocket", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("sanity", func() { resources := ` diff --git a/test/e2e/suite-chore/consistency.go b/test/e2e/suite-chore/consistency.go index e7294119c..79ea7c3d4 100644 --- a/test/e2e/suite-chore/consistency.go +++ b/test/e2e/suite-chore/consistency.go @@ -133,7 +133,8 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the CRDs re assert.Nil(ginkgo.GinkgoT(), err) assert.Len(ginkgo.GinkgoT(), upstreams, 1) assert.Contains(ginkgo.GinkgoT(), upstreams[0].Name, "httpbin-service-e2e-test_80") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK) }) } @@ -143,7 +144,7 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the CRDs re }) }) -var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the Ingress resource of the IngressController", func() { +var _ = ginkgo.PDescribe("suite-chore: Consistency between APISIX and the Ingress resource of the IngressController", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("Ingress v1 and APISIX of route and upstream", func() { httpService := fmt.Sprintf(_httpServiceConfig, "port1", 9080, 9080) diff --git a/test/e2e/suite-chore/endpoints.go b/test/e2e/suite-chore/endpoints.go index 04326151c..b8e72ad94 100644 --- a/test/e2e/suite-chore/endpoints.go +++ b/test/e2e/suite-chore/endpoints.go @@ -50,6 +50,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK) }) diff --git a/test/e2e/suite-chore/resolvegranularity.go b/test/e2e/suite-chore/resolvegranularity.go index bb796b899..fe060d46b 100644 --- a/test/e2e/suite-chore/resolvegranularity.go +++ b/test/e2e/suite-chore/resolvegranularity.go @@ -14,106 +14,117 @@ // limitations under the License. package chore -// var _ = ginkgo.Describe("suite-chore: ApisixRoute resolvegranularity Testing", func() { -// s := scaffold.NewDefaultScaffold() -// ginkgo.It("service and upstream [1:m]", func() { -// if s.IsEtcdServer() { -// ginkgo.Skip("Does not support etcdserver mode, etcdserver does not support full synchronization") -// } -// assert.Nil(ginkgo.GinkgoT(), s.ScaleHTTPBIN(2)) -// time.Sleep(5 * time.Second) +import ( + "fmt" + "net/http" + "time" -// backendSvc, backendSvcPort := s.DefaultHTTPBackend() -// route1 := fmt.Sprintf(` -// apiVersion: apisix.apache.org/v2 -// kind: ApisixRoute -// metadata: -// name: httpbin-route1 -// spec: -// http: -// - name: route1 -// match: -// hosts: -// - httpbin.org -// paths: -// - /ip -// backends: -// - serviceName: %s -// servicePort: %d -// resolveGranularity: service -// `, backendSvc, backendSvcPort[0]) -// assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(route1)) -// assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "checking number of routes") -// ups, err := s.ListApisixUpstreams() -// assert.Nil(ginkgo.GinkgoT(), err) -// assert.Len(ginkgo.GinkgoT(), ups, 1) -// assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 1) -// _ = s.NewAPISIXClient().GET("/ip"). -// WithHeader("Host", "httpbin.org"). -// Expect(). -// Status(http.StatusOK) + "github.com/onsi/ginkgo/v2" + "github.com/stretchr/testify/assert" -// route2 := fmt.Sprintf(` -// apiVersion: apisix.apache.org/v2 -// kind: ApisixRoute -// metadata: -// name: httpbin-route2 -// spec: -// http: -// - name: route2 -// match: -// hosts: -// - httpbin.com -// paths: -// - /get -// backends: -// - serviceName: %s -// servicePort: %d -// resolveGranularity: endpoint -// `, backendSvc, backendSvcPort[0]) -// assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(route2)) -// assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(2), "checking number of routes") -// ups, err = s.ListApisixUpstreams() -// assert.Nil(ginkgo.GinkgoT(), err) -// assert.Len(ginkgo.GinkgoT(), ups, 2) -// if len(ups[0].Nodes) == 1 { -// assert.Len(ginkgo.GinkgoT(), ups[1].Nodes, 2) -// } else { -// assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 2) -// assert.Len(ginkgo.GinkgoT(), ups[1].Nodes, 1) -// } -// _ = s.NewAPISIXClient().GET("/get"). -// WithHeader("Host", "httpbin.com"). -// Expect(). -// Status(http.StatusOK) -// // Verify consistency after apisix-ingress-controller restart -// verify := func() { -// s.RestartIngressControllerDeploy() -// time.Sleep(15 * time.Second) + "github.com/api7/api7-ingress-controller/test/e2e/scaffold" +) -// ups, err = s.ListApisixUpstreams() -// assert.Nil(ginkgo.GinkgoT(), err) -// assert.Len(ginkgo.GinkgoT(), ups, 2) -// if len(ups[0].Nodes) == 1 { -// assert.Len(ginkgo.GinkgoT(), ups[1].Nodes, 2) -// } else { -// assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 2) -// assert.Len(ginkgo.GinkgoT(), ups[1].Nodes, 1) -// } +var _ = ginkgo.PDescribe("suite-chore: ApisixRoute resolvegranularity Testing", func() { + s := scaffold.NewDefaultScaffold() + ginkgo.It("service and upstream [1:m]", func() { + if s.IsEtcdServer() { + ginkgo.Skip("Does not support etcdserver mode, etcdserver does not support full synchronization") + } + assert.Nil(ginkgo.GinkgoT(), s.ScaleHTTPBIN(2)) + time.Sleep(5 * time.Second) -// _ = s.NewAPISIXClient().GET("/ip"). -// WithHeader("Host", "httpbin.org"). -// Expect(). -// Status(http.StatusOK) + backendSvc, backendSvcPort := s.DefaultHTTPBackend() + route1 := fmt.Sprintf(` +apiVersion: apisix.apache.org/v2 +kind: ApisixRoute +metadata: + name: httpbin-route1 +spec: + http: + - name: route1 + match: + hosts: + - httpbin.org + paths: + - /ip + backends: + - serviceName: %s + servicePort: %d + resolveGranularity: service +`, backendSvc, backendSvcPort[0]) + assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(route1)) + assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "checking number of routes") + ups, err := s.ListApisixUpstreams() + assert.Nil(ginkgo.GinkgoT(), err) + assert.Len(ginkgo.GinkgoT(), ups, 1) + assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 1) + _ = s.NewAPISIXClient().GET("/ip"). + WithHeader("Host", "httpbin.org"). + Expect(). + Status(http.StatusOK) -// _ = s.NewAPISIXClient().GET("/get"). -// WithHeader("Host", "httpbin.com"). -// Expect(). -// Status(http.StatusOK) -// } + route2 := fmt.Sprintf(` +apiVersion: apisix.apache.org/v2 +kind: ApisixRoute +metadata: + name: httpbin-route2 +spec: + http: + - name: route2 + match: + hosts: + - httpbin.com + paths: + - /get + backends: + - serviceName: %s + servicePort: %d + resolveGranularity: endpoint +`, backendSvc, backendSvcPort[0]) + assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(route2)) + assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(2), "checking number of routes") + ups, err = s.ListApisixUpstreams() + assert.Nil(ginkgo.GinkgoT(), err) + assert.Len(ginkgo.GinkgoT(), ups, 2) + if len(ups[0].Nodes) == 1 { + assert.Len(ginkgo.GinkgoT(), ups[1].Nodes, 2) + } else { + assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 2) + assert.Len(ginkgo.GinkgoT(), ups[1].Nodes, 1) + } + _ = s.NewAPISIXClient().GET("/get"). + WithHeader("Host", "httpbin.com"). + Expect(). + Status(http.StatusOK) + // Verify consistency after apisix-ingress-controller restart + verify := func() { + s.RestartIngressControllerDeploy() + time.Sleep(15 * time.Second) -// for i := 0; i < 5; i++ { -// verify() -// } -// }) -// }) + ups, err = s.ListApisixUpstreams() + assert.Nil(ginkgo.GinkgoT(), err) + assert.Len(ginkgo.GinkgoT(), ups, 2) + if len(ups[0].Nodes) == 1 { + assert.Len(ginkgo.GinkgoT(), ups[1].Nodes, 2) + } else { + assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 2) + assert.Len(ginkgo.GinkgoT(), ups[1].Nodes, 1) + } + + _ = s.NewAPISIXClient().GET("/ip"). + WithHeader("Host", "httpbin.org"). + Expect(). + Status(http.StatusOK) + + _ = s.NewAPISIXClient().GET("/get"). + WithHeader("Host", "httpbin.com"). + Expect(). + Status(http.StatusOK) + } + + for i := 0; i < 5; i++ { + verify() + } + }) +}) diff --git a/test/e2e/suite-features/external-sd.go b/test/e2e/suite-features/external-sd.go index eade11c45..f134536ef 100644 --- a/test/e2e/suite-features/external-sd.go +++ b/test/e2e/suite-features/external-sd.go @@ -238,6 +238,11 @@ spec: // -- validation -- upstreamId := PhaseValidateFirstUpstream(s, 1, fqdn, "dns") PhaseValidateRouteAccess(s, upstreamId) + + //Check the status of ApisixUpstream resource + s.AssertCRSync("httpbin-upstream", "au", "Sync Successfully") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") }) }) @@ -256,6 +261,12 @@ spec: // -- validation -- upstreamId := PhaseValidateFirstUpstream(s, 1, fqdn, "dns") PhaseValidateRouteAccess(s, upstreamId) + + //Check the status of ApisixUpstream resource + s.AssertCRSync("httpbin-upstream", "au", "Sync Successfully") + + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") }) ginkgo.It("should be able to create the target service later", func() { @@ -272,6 +283,12 @@ spec: // -- validation -- upstreamId := PhaseValidateFirstUpstream(s, 1, fqdn, "dns") PhaseValidateRouteAccess(s, upstreamId) + + //Check the status of ApisixUpstream resource + s.AssertCRSync("httpbin-upstream", "au", "Sync Successfully") + + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") }) }) @@ -287,6 +304,12 @@ spec: upstreamId := PhaseValidateFirstUpstream(s, 1, fqdn, "dns") PhaseValidateRouteAccess(s, upstreamId) + //Check the status of ApisixUpstream resource + s.AssertCRSync("httpbin-upstream", "au", "Sync Successfully") + + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + // -- delete -- assert.Nil(ginkgo.GinkgoT(), s.DeleteResource("ar", "httpbin-route"), "delete route") assert.Nil(ginkgo.GinkgoT(), s.DeleteResource("au", "httpbin-upstream"), "delete upstream") diff --git a/test/e2e/suite-features/global_rule.go b/test/e2e/suite-features/global_rule.go index 5402652d1..82249086a 100644 --- a/test/e2e/suite-features/global_rule.go +++ b/test/e2e/suite-features/global_rule.go @@ -49,6 +49,9 @@ spec: _, ok := grs[0].Plugins["echo"] assert.Equal(ginkgo.GinkgoT(), ok, true) + //Check the status of ApisixUpstream resource + s.AssertCRSync("test-agr-1", "agr", "Sync Successfully") + s.NewAPISIXClient().GET("/anything").Expect().Body().Contains("hello, world!!") s.NewAPISIXClient().GET("/hello").Expect().Body().Contains("hello, world!!") @@ -77,6 +80,9 @@ spec: _, ok := grs[0].Plugins["echo"] assert.Equal(ginkgo.GinkgoT(), ok, true) + //Check the status of ApisixUpstream resource + s.AssertCRSync("test-agr-1", "agr", "Sync Successfully") + s.NewAPISIXClient().GET("/anything").Expect().Body().Contains("hello, world!!") s.NewAPISIXClient().GET("/hello").Expect().Body().Contains("hello, world!!") @@ -100,7 +106,6 @@ spec: assert.Len(ginkgo.GinkgoT(), grs, 1) _, ok = grs[0].Plugins["echo"] assert.Equal(ginkgo.GinkgoT(), ok, false) - s.NewAPISIXClient().GET("/anything").Expect().Body().NotContains("hello, world!!") }) @@ -127,6 +132,9 @@ spec: _, ok := grs[0].Plugins["echo"] assert.Equal(ginkgo.GinkgoT(), ok, true) + //Check the status of ApisixUpstream resource + s.AssertCRSync("test-agr-1", "agr", "Sync Successfully") + assert.Nil(ginkgo.GinkgoT(), s.DeleteResourceFromString(agr), "deleteing ApisixGlobalRule") time.Sleep(6 * time.Second) diff --git a/test/e2e/suite-features/healthcheck.go b/test/e2e/suite-features/healthcheck.go index cdf41b4dc..60f8a1efb 100644 --- a/test/e2e/suite-features/healthcheck.go +++ b/test/e2e/suite-features/healthcheck.go @@ -80,6 +80,13 @@ spec: assert.Equal(ginkgo.GinkgoT(), ups[0].Checks.Active.Unhealthy.Interval, 1) assert.Equal(ginkgo.GinkgoT(), ups[0].Checks.Active.Unhealthy.HTTPFailures, 2) + //Check the status of ApisixUpstream resource + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "Sync Successfully") + + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + // It's difficult to test healthchecker since we cannot let partial httpbin endpoints // down, if all of them are down, apisix in turn uses all of them. }) @@ -141,6 +148,12 @@ spec: assert.Equal(ginkgo.GinkgoT(), ups[0].Checks.Active.Unhealthy.Interval, 1) assert.Equal(ginkgo.GinkgoT(), ups[0].Checks.Passive.Healthy.HTTPStatuses, []int{200}) assert.Equal(ginkgo.GinkgoT(), ups[0].Checks.Passive.Unhealthy.HTTPStatuses, []int{502}) + + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "Sync Successfully") + + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") }) } ginkgo.Describe("suite-features: scaffold v2", func() { diff --git a/test/e2e/suite-features/remote_addrs_match.go b/test/e2e/suite-features/remote_addrs_match.go index a13ccce83..7e60bf06f 100644 --- a/test/e2e/suite-features/remote_addrs_match.go +++ b/test/e2e/suite-features/remote_addrs_match.go @@ -86,6 +86,9 @@ spec: err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + resp = s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().Contains("origin") diff --git a/test/e2e/suite-features/retries.go b/test/e2e/suite-features/retries.go index 93814fa5b..da18aca6c 100644 --- a/test/e2e/suite-features/retries.go +++ b/test/e2e/suite-features/retries.go @@ -67,6 +67,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err) assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Nil(ginkgo.GinkgoT(), ups[0].Retries) + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") }) ginkgo.It("is zero", func() { @@ -92,6 +94,11 @@ spec: assert.Nil(ginkgo.GinkgoT(), err) assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Equal(ginkgo.GinkgoT(), *ups[0].Retries, 0) + + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "Sync Successfully") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") }) ginkgo.It("is a positive number", func() { @@ -117,6 +124,11 @@ spec: assert.Nil(ginkgo.GinkgoT(), err) assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Equal(ginkgo.GinkgoT(), *ups[0].Retries, 3) + + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "Sync Successfully") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") }) } @@ -172,6 +184,11 @@ spec: assert.Equal(ginkgo.GinkgoT(), ups[0].Timeout.Connect, 60) assert.Equal(ginkgo.GinkgoT(), ups[0].Timeout.Read, 10) assert.Equal(ginkgo.GinkgoT(), ups[0].Timeout.Send, 10) + + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "Sync Successfully") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") }) } diff --git a/test/e2e/suite-features/route_filter_func.go b/test/e2e/suite-features/route_filter_func.go index 8f9283bb3..ac110104f 100644 --- a/test/e2e/suite-features/route_filter_func.go +++ b/test/e2e/suite-features/route_filter_func.go @@ -54,6 +54,9 @@ spec: err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). Expect(). diff --git a/test/e2e/suite-features/route_match_exprs.go b/test/e2e/suite-features/route_match_exprs.go index b1d5e3269..bf661231a 100644 --- a/test/e2e/suite-features/route_match_exprs.go +++ b/test/e2e/suite-features/route_match_exprs.go @@ -63,6 +63,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Foo", "bar"). @@ -112,7 +115,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). Expect(). @@ -163,6 +167,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithQuery("id", 100). @@ -222,6 +229,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithQuery("id", 100). @@ -287,6 +297,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithQuery("ID", 12). @@ -346,6 +359,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithQuery("ID", 12). @@ -410,6 +426,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("Content-Type", "text/html"). @@ -468,6 +487,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("Content-Type", "text/png"). @@ -526,6 +548,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Real-Uri", "/ip/098/v4"). @@ -585,6 +610,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Real-Uri", "/ip/0983/v4"). @@ -643,6 +671,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Real-Uri", "/IP/098/v4"). @@ -701,6 +732,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Real-Uri", "/IP/0983/v4"). @@ -776,6 +810,9 @@ spec: time.Sleep(6 * time.Second) assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1)) + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + routes, err := s.ListApisixRoutes() assert.Nil(ginkgo.GinkgoT(), err) assert.Len(ginkgo.GinkgoT(), routes, 2) @@ -845,6 +882,9 @@ spec: time.Sleep(6 * time.Second) assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/get"). WithHeader("Host", "httpbin.org"). Expect(). @@ -893,6 +933,9 @@ spec: time.Sleep(6 * time.Second) assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.net"). Expect(). @@ -947,6 +990,9 @@ spec: time.Sleep(6 * time.Second) assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + _ = s.NewAPISIXClient().GET("/get"). WithHeader("Host", "httpbin.net"). Expect(). diff --git a/test/e2e/suite-features/scheme.go b/test/e2e/suite-features/scheme.go index 0786bc2c4..0f2901e57 100644 --- a/test/e2e/suite-features/scheme.go +++ b/test/e2e/suite-features/scheme.go @@ -91,6 +91,11 @@ spec: assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Equal(ginkgo.GinkgoT(), ups[0].Scheme, "grpc") + //Check the status of ApisixUpstream resource + s.AssertCRSync("grpc-server-service", "au", "Sync Successfully") + + //Check the status of ApisixRoute resource + s.AssertCRSync("grpc-route", "ar", "Sync Successfully") // TODO enable the following test cases once APISIX supports HTTP/2 in plain. // ep, err := s.GetAPISIXEndpoint() // assert.Nil(ginkgo.GinkgoT(), err) @@ -164,6 +169,12 @@ spec: assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Equal(ginkgo.GinkgoT(), ups[0].Scheme, "grpcs") + //Check the status of ApisixUpstream resource + s.AssertCRSync("test-backend-service-e2e-test", "au", "upstream doesn't exist. It will be created after ApisixRoute is created referencing it.") + + //Check the status of ApisixRoute resource + s.AssertCRSync("grpcs-route", "ar", "Sync Successfully") + ca, err := os.ReadFile("testbackend/tls/ca.pem") assert.NoError(ginkgo.GinkgoT(), err, "read ca cert") assert.NoError(ginkgo.GinkgoT(), client.RequestHello(s.GetAPISIXHTTPSEndpoint(), ca), "request apisix using grpc protocol") diff --git a/test/e2e/suite-features/subset.go b/test/e2e/suite-features/subset.go index b6f74d201..187de4741 100644 --- a/test/e2e/suite-features/subset.go +++ b/test/e2e/suite-features/subset.go @@ -61,6 +61,8 @@ spec: assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 0, "upstreams nodes not expect") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.com").Expect().Status(http.StatusServiceUnavailable).Body().Raw() }) @@ -110,6 +112,12 @@ spec: assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 0, "upstreams nodes not expect") + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "upstream doesn't exist. It will be created after ApisixRoute is created referencing it.") + + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.com").Expect().Status(http.StatusServiceUnavailable).Body().Raw() }) @@ -162,6 +170,12 @@ spec: assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Len(ginkgo.GinkgoT(), ups[0].Nodes, 2, "upstreams nodes not expect") + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "upstream doesn't exist. It will be created after ApisixRoute is created referencing it.") + + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.com").Expect().Status(http.StatusOK).Body().Raw() }) } diff --git a/test/e2e/suite-features/sync-comparison.go b/test/e2e/suite-features/sync-comparison.go index 95269efef..1c26554f2 100644 --- a/test/e2e/suite-features/sync-comparison.go +++ b/test/e2e/suite-features/sync-comparison.go @@ -56,6 +56,9 @@ spec: err = s.EnsureNumApisixUpstreamsCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "checking number of upstreams") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + arStream := fmt.Sprintf(` apiVersion: apisix.apache.org/v2 kind: ApisixRoute @@ -82,6 +85,8 @@ spec: err = s.NewApisixTls("tls-server-a", hostA, secretA) assert.Nil(ginkgo.GinkgoT(), err, "create ApisixTls 'a' error") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-tcp-route", "ar", "Sync Successfully") ac := ` apiVersion: apisix.apache.org/v2 kind: ApisixConsumer @@ -94,7 +99,9 @@ spec: key: foo-key ` assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ac), "create ApisixConsumer") - + time.Sleep(6 * time.Second) + //Check the status of ApisixRoute resource + s.AssertCRSync("foo", "ac", "Sync Successfully") agr := ` apiVersion: apisix.apache.org/v2 kind: ApisixGlobalRule @@ -108,8 +115,9 @@ spec: body: "hello, world!!" ` assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(agr), "create ApisixGlobalRule") - - apc := fmt.Sprintf(` + //Check the status of ApisixRoute resource + s.AssertCRSync("test-agr-1", "agr", "Sync Successfully") + apc := ` apiVersion: apisix.apache.org/v2 kind: ApisixPluginConfig metadata: @@ -118,7 +126,7 @@ spec: plugins: - name: cors enable: true -`) +` assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(apc), "create ApisixPluginConfig") // ensure resources exist, so ResourceSync will be triggered diff --git a/test/e2e/suite-features/traffic_split.go b/test/e2e/suite-features/traffic_split.go index bb9a70350..eff9fb044 100644 --- a/test/e2e/suite-features/traffic_split.go +++ b/test/e2e/suite-features/traffic_split.go @@ -61,6 +61,8 @@ spec: err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // Send requests to APISIX. var ( num404 int diff --git a/test/e2e/suite-features/upstream_pass_host.go b/test/e2e/suite-features/upstream_pass_host.go index 74b35fb9c..6f13deb90 100644 --- a/test/e2e/suite-features/upstream_pass_host.go +++ b/test/e2e/suite-features/upstream_pass_host.go @@ -69,6 +69,10 @@ spec: assert.Nil(ginkgo.GinkgoT(), err) assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Equal(ginkgo.GinkgoT(), "node", ups[0].PassHost) + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "Sync Successfully") }) ginkgo.It("is set to rewrite with upstream host", func() { @@ -96,6 +100,8 @@ spec: assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Equal(ginkgo.GinkgoT(), "rewrite", ups[0].PassHost) assert.Equal(ginkgo.GinkgoT(), "host", ups[0].UpstreamHost) + //Check the status of ApisixUpstream resource + s.AssertCRSync(backendSvc, "au", "Sync Successfully") }) ginkgo.It("is set to node with upstream host", func() { @@ -123,6 +129,10 @@ spec: assert.Len(ginkgo.GinkgoT(), ups, 1) assert.Equal(ginkgo.GinkgoT(), "node", ups[0].PassHost) assert.Equal(ginkgo.GinkgoT(), "host", ups[0].UpstreamHost) + //Check the status of ApisixUpstream resource + upsRoute, err := s.GetApisixResourceStatus(backendSvc, "au") + assert.Nil(ginkgo.GinkgoT(), err) + assert.Equal(ginkgo.GinkgoT(), "Sync Successfully", upsRoute.Conditions[0].Message) }) ginkgo.It("is set to invalid value", func() { diff --git a/test/e2e/suite-features/websocket.go b/test/e2e/suite-features/websocket.go index de001a944..3fabfa9c0 100644 --- a/test/e2e/suite-features/websocket.go +++ b/test/e2e/suite-features/websocket.go @@ -85,6 +85,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") dialer := websocket.Dialer{} u := url.URL{ diff --git a/test/e2e/suite-gateway/gateway_httproute.go b/test/e2e/suite-gateway/gateway_httproute.go index e2e1a47cf..da12b690d 100644 --- a/test/e2e/suite-gateway/gateway_httproute.go +++ b/test/e2e/suite-gateway/gateway_httproute.go @@ -27,7 +27,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-gateway: HTTPRoute", func() { +var _ = ginkgo.PDescribe("suite-gateway: HTTPRoute", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("Basic HTTPRoute with 1 Hosts 1 Rule 1 Match 1 BackendRef", func() { @@ -236,7 +236,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-gateway: HTTPRoute with filter", func() { +var _ = ginkgo.PDescribe("suite-gateway: HTTPRoute with filter", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("HTTPRoute with RequestHeaderModifier", func() { backendSvc, backendPorts := s.DefaultHTTPBackend() diff --git a/test/e2e/suite-gateway/gateway_tcproute.go b/test/e2e/suite-gateway/gateway_tcproute.go index 21445a06e..94d7f931b 100644 --- a/test/e2e/suite-gateway/gateway_tcproute.go +++ b/test/e2e/suite-gateway/gateway_tcproute.go @@ -27,7 +27,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-gateway: TCP Route", func() { +var _ = ginkgo.PDescribe("suite-gateway: TCP Route", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("create TCPRoute", func() { backendSvc, backendPorts := s.DefaultHTTPBackend() diff --git a/test/e2e/suite-gateway/gateway_tlsroute.go b/test/e2e/suite-gateway/gateway_tlsroute.go index befc4443c..0f6e73aaf 100644 --- a/test/e2e/suite-gateway/gateway_tlsroute.go +++ b/test/e2e/suite-gateway/gateway_tlsroute.go @@ -128,7 +128,7 @@ jW4KB95bGOTa7r7DM1Up0MbAIwWoeLBGhOIXk7inurZGg+FNjZMA5Lzm6qo= assert.Equal(ginkgo.GinkgoT(), cert, tls[0].Cert, "tls cert not expect") } -var _ = ginkgo.Describe("suite-gateway: TLSRoute", func() { +var _ = ginkgo.PDescribe("suite-gateway: TLSRoute", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("Basic with 1 Hosts 1 Rule 1 Match 1 BackendRef", func() { diff --git a/test/e2e/suite-gateway/gateway_udproute.go b/test/e2e/suite-gateway/gateway_udproute.go index 4f410a7d2..8743358e6 100644 --- a/test/e2e/suite-gateway/gateway_udproute.go +++ b/test/e2e/suite-gateway/gateway_udproute.go @@ -26,7 +26,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-gateway: UDP Route", func() { +var _ = ginkgo.PDescribe("suite-gateway: UDP Route", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("UDPRoute", func() { diff --git a/test/e2e/suite-gateway/route_attchment.go b/test/e2e/suite-gateway/route_attchment.go index 2e5c9f387..79dac11cd 100644 --- a/test/e2e/suite-gateway/route_attchment.go +++ b/test/e2e/suite-gateway/route_attchment.go @@ -26,7 +26,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-gateway: Route Attachment", func() { +var _ = ginkgo.PDescribe("suite-gateway: Route Attachment", func() { s := scaffold.NewDefaultScaffold() gatewayClassName := "test-gateway-class" diff --git a/test/e2e/suite-ingress/suite-ingress-features/compare.go b/test/e2e/suite-ingress/suite-ingress-features/compare.go index be099b77a..e70aa38ae 100644 --- a/test/e2e/suite-ingress/suite-ingress-features/compare.go +++ b/test/e2e/suite-ingress/suite-ingress-features/compare.go @@ -24,7 +24,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-features: Testing compare resources", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: Testing compare resources", func() { suites := func(scaffoldFunc func() *scaffold.Scaffold) { s := scaffoldFunc() ginkgo.It("Compare and find out the redundant objects in APISIX, and remove them", func() { @@ -69,7 +69,7 @@ spec: }) } - ginkgo.Describe("suite-ingress-features: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-features: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold) }) }) diff --git a/test/e2e/suite-ingress/suite-ingress-features/ingress-class.go b/test/e2e/suite-ingress/suite-ingress-features/ingress-class.go index 7543bdd03..ee9852549 100644 --- a/test/e2e/suite-ingress/suite-ingress-features/ingress-class.go +++ b/test/e2e/suite-ingress/suite-ingress-features/ingress-class.go @@ -76,7 +76,7 @@ wrw7im4TNSAdwVX4Y1F4svJ2as5SJn5QYGAzXDixNuwzXYrpP9rzA2s= -----END RSA PRIVATE KEY-----` ) -var _ = ginkgo.Describe("suite-ingress-features: Testing CRDs with IngressClass", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: Testing CRDs with IngressClass", func() { s := scaffold.NewScaffold(&scaffold.Options{ Name: "ingress-class", IngressAPISIXReplicas: 1, diff --git a/test/e2e/suite-ingress/suite-ingress-features/namespace.go b/test/e2e/suite-ingress/suite-ingress-features/namespace.go index 95b50f913..19c2ac9ed 100644 --- a/test/e2e/suite-ingress/suite-ingress-features/namespace.go +++ b/test/e2e/suite-ingress/suite-ingress-features/namespace.go @@ -39,7 +39,7 @@ type headers struct { } `json:"headers"` } -var _ = ginkgo.Describe("suite-ingress-features: multiple values for same label key", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: multiple values for same label key", func() { const ns1 = "nstestinga" const labelKey = "nstesting" @@ -134,7 +134,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-features: namespacing filtering enable", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: namespacing filtering enable", func() { watchedNamespace := fmt.Sprintf("namespace-selector-1-%d", time.Now().Nanosecond()) s := scaffold.NewScaffold(&scaffold.Options{ Name: "enable-namespace-selector", @@ -219,7 +219,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-features: namespacing filtering disable", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: namespacing filtering disable", func() { s := scaffold.NewScaffold(&scaffold.Options{ Name: "disable-namespace-selector", IngressAPISIXReplicas: 1, @@ -309,7 +309,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-features: namespacing un-label", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: namespacing un-label", func() { labelName, labelValue := fmt.Sprintf("namespace-selector-%d", time.Now().Nanosecond()), "watch" s := scaffold.NewScaffold(&scaffold.Options{ Name: "un-label", @@ -443,7 +443,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-features: namespacing from no-label to label", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: namespacing from no-label to label", func() { labelName, labelValue := fmt.Sprintf("namespace-selector-%d", time.Now().Nanosecond()), "watch" s := scaffold.NewScaffold(&scaffold.Options{ Name: "from-no-label-to-label", diff --git a/test/e2e/suite-ingress/suite-ingress-features/resourcesync.go b/test/e2e/suite-ingress/suite-ingress-features/resourcesync.go index f800c99a8..3b45eaf43 100644 --- a/test/e2e/suite-ingress/suite-ingress-features/resourcesync.go +++ b/test/e2e/suite-ingress/suite-ingress-features/resourcesync.go @@ -27,7 +27,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-features: apisix resource sync", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: apisix resource sync", func() { suites := func(s *scaffold.Scaffold) { ginkgo.JustBeforeEach(func() { if s.IsEtcdServer() { @@ -312,7 +312,7 @@ spec: }) } - ginkgo.Describe("suite-ingress-features: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-features: scaffold v2", func() { suites(scaffold.NewScaffold(&scaffold.Options{ Name: "sync", IngressAPISIXReplicas: 1, diff --git a/test/e2e/suite-ingress/suite-ingress-features/sanity.go b/test/e2e/suite-ingress/suite-ingress-features/sanity.go index ee62b7771..6c3e53dd1 100644 --- a/test/e2e/suite-ingress/suite-ingress-features/sanity.go +++ b/test/e2e/suite-ingress/suite-ingress-features/sanity.go @@ -30,7 +30,7 @@ type ip struct { IP string `json:"origin"` } -var _ = ginkgo.Describe("suite-ingress-features: single-route", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: single-route", func() { suites := func(s *scaffold.Scaffold) { ginkgo.It("/ip should return your ip", func() { backendSvc, backendSvcPort := s.DefaultHTTPBackend() @@ -69,12 +69,12 @@ spec: }) } - ginkgo.Describe("suite-ingress-features: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-features: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold()) }) }) -var _ = ginkgo.Describe("suite-ingress-features: double-routes", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: double-routes", func() { suites := func(s *scaffold.Scaffold) { ginkgo.It("double routes work independently", func() { backendSvc, backendSvcPort := s.DefaultHTTPBackend() @@ -124,12 +124,12 @@ spec: }) } - ginkgo.Describe("suite-ingress-features: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-features: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold()) }) }) -var _ = ginkgo.Describe("suite-ingress-features: leader election", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: leader election", func() { suites := func(s *scaffold.Scaffold) { ginkgo.It("lease check", func() { pods, err := s.GetIngressPodDetails() @@ -178,7 +178,7 @@ var _ = ginkgo.Describe("suite-ingress-features: leader election", func() { }) } - ginkgo.Describe("suite-ingress-features: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-features: scaffold v2", func() { suites(scaffold.NewScaffold(&scaffold.Options{ Name: "leaderelection", IngressAPISIXReplicas: 2, @@ -187,7 +187,7 @@ var _ = ginkgo.Describe("suite-ingress-features: leader election", func() { }) }) -var _ = ginkgo.Describe("suite-ingress-features: stream_routes disabled", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: stream_routes disabled", func() { suites := func(s *scaffold.Scaffold) { ginkgo.It("/ip should return your ip", func() { backendSvc, backendSvcPort := s.DefaultHTTPBackend() @@ -226,7 +226,7 @@ spec: }) } - ginkgo.Describe("suite-ingress-features: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-features: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold()) }) }) diff --git a/test/e2e/suite-ingress/suite-ingress-features/secret.go b/test/e2e/suite-ingress/suite-ingress-features/secret.go index fb9a0389f..c41755be9 100644 --- a/test/e2e/suite-ingress/suite-ingress-features/secret.go +++ b/test/e2e/suite-ingress/suite-ingress-features/secret.go @@ -26,7 +26,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-features: secret controller", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: secret controller", func() { apisixTlsSuites := func(s *scaffold.Scaffold) { ginkgo.It("should create SSL if secret name referenced by TLS is corrected later", func() { secretName := "test-apisix-tls" @@ -1399,7 +1399,7 @@ UnBVSIGJ/c0AhVSDuOAJiF36pvsDysTZXMTFE/9i5bkGOiwtzRNe4Hym/SEZUCpn }) } - ginkgo.Describe("suite-ingress-features: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-features: scaffold v2", func() { s := scaffold.NewDefaultV2Scaffold() apisixTlsSuites(s) ingressSuites(s) diff --git a/test/e2e/suite-ingress/suite-ingress-features/status.go b/test/e2e/suite-ingress/suite-ingress-features/status.go index 3d97daf09..736f6aae2 100644 --- a/test/e2e/suite-ingress/suite-ingress-features/status.go +++ b/test/e2e/suite-ingress/suite-ingress-features/status.go @@ -27,7 +27,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-features: CRDs status subresource Testing", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: CRDs status subresource Testing", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("check ApisixRoute status is recorded", func() { backendSvc, backendSvcPort := s.DefaultHTTPBackend() @@ -248,7 +248,7 @@ wrw7im4TNSAdwVX4Y1F4svJ2as5SJn5QYGAzXDixNuwzXYrpP9rzA2s= }) }) -var _ = ginkgo.Describe("suite-ingress-features: Ingress LB Status Testing", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: Ingress LB Status Testing", func() { opts := &scaffold.Options{ Name: "default", IngressAPISIXReplicas: 1, @@ -291,7 +291,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-features: disable status", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: disable status", func() { opts := &scaffold.Options{ Name: "default", IngressAPISIXReplicas: 1, diff --git a/test/e2e/suite-ingress/suite-ingress-features/webhook.go b/test/e2e/suite-ingress/suite-ingress-features/webhook.go index 2abaaa0b8..ea8e6eabc 100644 --- a/test/e2e/suite-ingress/suite-ingress-features/webhook.go +++ b/test/e2e/suite-ingress/suite-ingress-features/webhook.go @@ -24,7 +24,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-features: Enable webhooks", func() { +var _ = ginkgo.PDescribe("suite-ingress-features: Enable webhooks", func() { s := scaffold.NewScaffold(&scaffold.Options{ Name: "webhook", IngressAPISIXReplicas: 1, diff --git a/test/e2e/suite-ingress/suite-ingress-resource/configmap.go b/test/e2e/suite-ingress/suite-ingress-resource/configmap.go index 3ccc81a1d..b682f446d 100644 --- a/test/e2e/suite-ingress/suite-ingress-resource/configmap.go +++ b/test/e2e/suite-ingress/suite-ingress-resource/configmap.go @@ -119,7 +119,7 @@ data: namespace: "apisix" ` -var _ = ginkgo.Describe("suite-ingress-resource: configmap Testing", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: configmap Testing", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("create configmap and configure config.yaml", func() { assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(_configmapConfigYAML)) diff --git a/test/e2e/suite-ingress/suite-ingress-resource/ingress.go b/test/e2e/suite-ingress/suite-ingress-resource/ingress.go index 918a6da66..cbaf9a461 100644 --- a/test/e2e/suite-ingress/suite-ingress-resource/ingress.go +++ b/test/e2e/suite-ingress/suite-ingress-resource/ingress.go @@ -35,7 +35,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-resource: support ingress https", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: support ingress https", func() { s := scaffold.NewDefaultScaffold() rootCA := `-----BEGIN CERTIFICATE----- @@ -384,7 +384,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-resource: support ingress.networking/v1", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: support ingress.networking/v1", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("path exact match", func() { @@ -518,7 +518,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-resource: support ingress.networking/v1beta1", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: support ingress.networking/v1beta1", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("path exact match", func() { @@ -613,7 +613,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-resource: support ingress.networking/v1 with headless service backend", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: support ingress.networking/v1 with headless service backend", func() { s := scaffold.NewDefaultScaffold() const _httpHeadlessService = ` @@ -748,7 +748,7 @@ spec: }) }) -var _ = ginkgo.Describe("suite-ingress-resource: svc delete", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: svc delete", func() { s := scaffold.NewDefaultScaffold() ginkgo.It("svc delete before ing delete", func() { backendSvc, backendSvcPort := s.DefaultHTTPBackend() diff --git a/test/e2e/suite-ingress/suite-ingress-resource/resourcepushing.go b/test/e2e/suite-ingress/suite-ingress-resource/resourcepushing.go index ab0e985bf..58816e2b6 100644 --- a/test/e2e/suite-ingress/suite-ingress-resource/resourcepushing.go +++ b/test/e2e/suite-ingress/suite-ingress-resource/resourcepushing.go @@ -26,7 +26,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-resource: ApisixRoute Testing", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: ApisixRoute Testing", func() { suites := func(scaffoldFunc func() *scaffold.Scaffold) { s := scaffoldFunc() ginkgo.It("create and then scale upstream pods to 2 ", func() { @@ -670,7 +670,7 @@ spec: }) } - ginkgo.Describe("suite-ingress-resource: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-resource: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold) }) }) diff --git a/test/e2e/suite-ingress/suite-ingress-resource/ssl.go b/test/e2e/suite-ingress/suite-ingress-resource/ssl.go index 99e493c3d..b2d4d8aa6 100644 --- a/test/e2e/suite-ingress/suite-ingress-resource/ssl.go +++ b/test/e2e/suite-ingress/suite-ingress-resource/ssl.go @@ -28,7 +28,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-resource: SSL Testing", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: SSL Testing", func() { suites := func(scaffoldFunc func() *scaffold.Scaffold) { s := scaffoldFunc() ginkgo.It("create a SSL from ApisixTls ", func() { @@ -236,12 +236,12 @@ RU+QPRECgYB6XW24EI5+w3STbpnc6VoTS+sy9I9abTJPYo9LpCJwfMYc9Tg9Cx2K }) } - ginkgo.Describe("suite-ingress-resource: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-resource: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold) }) }) -var _ = ginkgo.Describe("suite-ingress-resource: ApisixTls mTLS Test", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: ApisixTls mTLS Test", func() { // RootCA -> Server // RootCA -> UserCert // These certs come from mTLS practice @@ -346,7 +346,7 @@ spec: }) } - ginkgo.Describe("suite-ingress-resource: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-resource: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold) }) }) diff --git a/test/e2e/suite-ingress/suite-ingress-resource/stream.go b/test/e2e/suite-ingress/suite-ingress-resource/stream.go index d4211569f..bfe833538 100644 --- a/test/e2e/suite-ingress/suite-ingress-resource/stream.go +++ b/test/e2e/suite-ingress/suite-ingress-resource/stream.go @@ -25,7 +25,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/scaffold" ) -var _ = ginkgo.Describe("suite-ingress-resource: ApisixRoute stream Testing", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: ApisixRoute stream Testing", func() { suites := func(s *scaffold.Scaffold) { ginkgo.It("stream tcp proxy", func() { backendSvc, backendSvcPort := s.DefaultHTTPBackend() @@ -98,12 +98,12 @@ spec: assert.Contains(ginkgo.GinkgoT(), output, "github.com. udp") }) } - ginkgo.Describe("suite-ingress-resource: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-resource: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold()) }) }) -var _ = ginkgo.Describe("suite-ingress-resource: ApisixRoute stream Testing SNI with v2", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: ApisixRoute stream Testing SNI with v2", func() { s := scaffold.NewDefaultV2Scaffold() ginkgo.It("stream route with sni when set host", func() { diff --git a/test/e2e/suite-ingress/suite-ingress-resource/upstream_tls.go b/test/e2e/suite-ingress/suite-ingress-resource/upstream_tls.go index a250ef149..84c93e8f0 100644 --- a/test/e2e/suite-ingress/suite-ingress-resource/upstream_tls.go +++ b/test/e2e/suite-ingress/suite-ingress-resource/upstream_tls.go @@ -26,7 +26,7 @@ import ( "github.com/api7/api7-ingress-controller/test/e2e/testbackend/client" ) -var _ = ginkgo.Describe("suite-ingress-resource: ApisixUpstreams mTLS test", func() { +var _ = ginkgo.PDescribe("suite-ingress-resource: ApisixUpstreams mTLS test", func() { clientSecret := `client-secret` f, err := os.ReadFile("testbackend/tls/client.pem") @@ -123,7 +123,7 @@ spec: }) } - ginkgo.Describe("suite-ingress-resource: scaffold v2", func() { + ginkgo.PDescribe("suite-ingress-resource: scaffold v2", func() { suites(scaffold.NewDefaultV2Scaffold()) }) }) diff --git a/test/e2e/suite-plugins/suite-plugins-authentication/basic.go b/test/e2e/suite-plugins/suite-plugins-authentication/basic.go index abd161af1..e42be6481 100644 --- a/test/e2e/suite-plugins/suite-plugins-authentication/basic.go +++ b/test/e2e/suite-plugins/suite-plugins-authentication/basic.go @@ -75,7 +75,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar), "creating ApisixRoute with basicAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Foo", "bar"). @@ -159,7 +160,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar), "creating ApisixRoute with basicAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Foo", "bar"). diff --git a/test/e2e/suite-plugins/suite-plugins-authentication/hmac.go b/test/e2e/suite-plugins/suite-plugins-authentication/hmac.go index bb49ffce3..bf7c2d2fd 100644 --- a/test/e2e/suite-plugins/suite-plugins-authentication/hmac.go +++ b/test/e2e/suite-plugins/suite-plugins-authentication/hmac.go @@ -51,6 +51,8 @@ spec: grs, err := s.ListApisixConsumers() assert.Nil(ginkgo.GinkgoT(), err, "listing consumer") assert.Len(ginkgo.GinkgoT(), grs, 1) + //Check the status of ApisixConsumer resource + s.AssertCRSync("hmacvalue", "ac", "Sync Successfully") assert.Len(ginkgo.GinkgoT(), grs[0].Plugins, 1) hmacAuth, _ := grs[0].Plugins["hmac-auth"].(map[string]interface{}) assert.Equal(ginkgo.GinkgoT(), "papa", hmacAuth["access_key"]) @@ -87,6 +89,7 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar), "creating ApisixRoute with hmacAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). diff --git a/test/e2e/suite-plugins/suite-plugins-authentication/jwt.go b/test/e2e/suite-plugins/suite-plugins-authentication/jwt.go index 34fced0f4..ce1e39269 100644 --- a/test/e2e/suite-plugins/suite-plugins-authentication/jwt.go +++ b/test/e2e/suite-plugins/suite-plugins-authentication/jwt.go @@ -48,6 +48,8 @@ spec: grs, err := s.ListApisixConsumers() assert.Nil(ginkgo.GinkgoT(), err, "listing consumer") + //Check the status of ApisixConsumer resource + s.AssertCRSync("foo", "ac", "Sync Successfully") assert.Len(ginkgo.GinkgoT(), grs, 1) assert.Len(ginkgo.GinkgoT(), grs[0].Plugins, 1) jwtAuth, _ := grs[0].Plugins["jwt-auth"].(map[string]interface{}) diff --git a/test/e2e/suite-plugins/suite-plugins-authentication/key.go b/test/e2e/suite-plugins/suite-plugins-authentication/key.go index 8c6ef4cda..ba14adf00 100644 --- a/test/e2e/suite-plugins/suite-plugins-authentication/key.go +++ b/test/e2e/suite-plugins/suite-plugins-authentication/key.go @@ -32,11 +32,13 @@ var _ = ginkgo.Describe("suite-plugins-authentication: ApisixConsumer with keyAu ginkgo.It("ApisixRoute with keyAuth consumer", func() { assert.Nil(ginkgo.GinkgoT(), s.ApisixConsumerKeyAuthCreated("keyvalue", "foo"), "creating keyAuth ApisixConsumer") - // Wait until the ApisixConsumer create event was delivered. + // Wait until the ApisixRoute create event was delivered. time.Sleep(6 * time.Second) grs, err := s.ListApisixConsumers() assert.Nil(ginkgo.GinkgoT(), err, "listing consumer") + //Check the status of ApisixConsumer resource + s.AssertCRSync("keyvalue", "ac", "Sync Successfully") assert.Len(ginkgo.GinkgoT(), grs, 1) assert.Len(ginkgo.GinkgoT(), grs[0].Plugins, 1) basicAuth, _ := grs[0].Plugins["key-auth"] @@ -74,7 +76,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar), "creating ApisixRoute with keyAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Foo", "bar"). @@ -156,7 +159,7 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar), "creating ApisixRoute with keyAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") - + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("X-Foo", "bar"). diff --git a/test/e2e/suite-plugins/suite-plugins-authentication/ldap.go b/test/e2e/suite-plugins/suite-plugins-authentication/ldap.go index c57d5db11..f6ed58254 100644 --- a/test/e2e/suite-plugins/suite-plugins-authentication/ldap.go +++ b/test/e2e/suite-plugins/suite-plugins-authentication/ldap.go @@ -60,6 +60,8 @@ spec: grs, err := s.ListApisixConsumers() assert.Nil(ginkgo.GinkgoT(), err, "listing consumer") + //Check the status of ApisixConsumer resource + s.AssertCRSync("jack", "ac", "Sync Successfully") assert.Len(ginkgo.GinkgoT(), grs, 1) assert.Len(ginkgo.GinkgoT(), grs[0].Plugins, 1) ldapAuth, _ := grs[0].Plugins["ldap-auth"].(map[string]interface{}) @@ -96,7 +98,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar), "Creating ApisixRoute with ldapAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") - + //Check the status of ApisixConsumer resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") msg401CourseMissing := s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). Expect(). @@ -150,6 +153,8 @@ spec: grs, err := s.ListApisixConsumers() assert.Nil(ginkgo.GinkgoT(), err, "listing consumer") + //Check the status of ApisixConsumer resource + s.AssertCRSync("jack", "ac", "Sync Successfully") assert.Len(ginkgo.GinkgoT(), grs, 1) assert.Len(ginkgo.GinkgoT(), grs[0].Plugins, 1) ldapAuth, _ := grs[0].Plugins["ldap-auth"].(map[string]interface{}) @@ -186,7 +191,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar), "Creating ApisixRoute with ldapAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") - + //Check the status of ApisixConsumer resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") msg401CouseMissing := s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). Expect(). diff --git a/test/e2e/suite-plugins/suite-plugins-authentication/wolfrbac.go b/test/e2e/suite-plugins/suite-plugins-authentication/wolfrbac.go index 02ac7f999..31a521c35 100644 --- a/test/e2e/suite-plugins/suite-plugins-authentication/wolfrbac.go +++ b/test/e2e/suite-plugins/suite-plugins-authentication/wolfrbac.go @@ -66,6 +66,8 @@ spec: time.Sleep(6 * time.Second) grs, err := s.ListApisixConsumers() + //Check the status of ApisixConsumer resource + s.AssertCRSync("wolf-user", "ac", "Sync Successfully") assert.Nil(ginkgo.GinkgoT(), err, "listing consumer") assert.Len(ginkgo.GinkgoT(), grs, 1) assert.Len(ginkgo.GinkgoT(), grs[0].Plugins, 1) diff --git a/test/e2e/suite-plugins/suite-plugins-general/echo.go b/test/e2e/suite-plugins/suite-plugins-general/echo.go index b45318b51..87fd39628 100644 --- a/test/e2e/suite-plugins/suite-plugins-general/echo.go +++ b/test/e2e/suite-plugins/suite-plugins-general/echo.go @@ -65,7 +65,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Header("X-Foo").Equal("v1") @@ -108,7 +109,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().Equal("my custom body") @@ -148,7 +150,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().Contains("origin") @@ -188,7 +191,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().Equal("my custom body") @@ -217,7 +221,8 @@ spec: // EnsureNumApisixRoutesCreated cannot be used to ensure update Correctness. time.Sleep(6 * time.Second) - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp = s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().NotContains("my custom body") diff --git a/test/e2e/suite-plugins/suite-plugins-general/redirect.go b/test/e2e/suite-plugins/suite-plugins-general/redirect.go index ff03f8d77..158cbb496 100644 --- a/test/e2e/suite-plugins/suite-plugins-general/redirect.go +++ b/test/e2e/suite-plugins/suite-plugins-general/redirect.go @@ -60,7 +60,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusMovedPermanently) resp.Header("Location").Equal("https://httpbin.org:9443/ip") @@ -99,7 +100,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusPermanentRedirect) resp.Header("Location").Equal("/ip/ipip") @@ -139,7 +141,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) }) @@ -176,7 +179,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusPermanentRedirect) resp.Header("Location").Equal("/ip/ipip") @@ -204,7 +208,8 @@ spec: // EnsureNumApisixRoutesCreated cannot be used to ensure update Correctness. time.Sleep(6 * time.Second) - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp = s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().Contains("origin") diff --git a/test/e2e/suite-plugins/suite-plugins-general/secret_ref.go b/test/e2e/suite-plugins/suite-plugins-general/secret_ref.go index 221a89f87..821928dd9 100644 --- a/test/e2e/suite-plugins/suite-plugins-general/secret_ref.go +++ b/test/e2e/suite-plugins/suite-plugins-general/secret_ref.go @@ -78,6 +78,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) @@ -136,7 +138,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Header("X-Foo").Equal("v2") diff --git a/test/e2e/suite-plugins/suite-plugins-other/mqtt-proxy.go b/test/e2e/suite-plugins/suite-plugins-other/mqtt-proxy.go index efc7a642d..07fdf7e3d 100644 --- a/test/e2e/suite-plugins/suite-plugins-other/mqtt-proxy.go +++ b/test/e2e/suite-plugins/suite-plugins-other/mqtt-proxy.go @@ -109,7 +109,8 @@ spec: err := s.EnsureNumApisixStreamRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("mqtt-route", "ar", "Sync Successfully") sr, err := s.ListApisixStreamRoutes() assert.Nil(ginkgo.GinkgoT(), err) assert.Len(ginkgo.GinkgoT(), sr, 1) diff --git a/test/e2e/suite-plugins/suite-plugins-other/plugin_config.go b/test/e2e/suite-plugins/suite-plugins-other/plugin_config.go index 7cf8ac635..68ffe1698 100644 --- a/test/e2e/suite-plugins/suite-plugins-other/plugin_config.go +++ b/test/e2e/suite-plugins/suite-plugins-other/plugin_config.go @@ -77,7 +77,8 @@ spec: err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") time.Sleep(3 * time.Second) pcs, err := s.ListApisixPluginConfig() assert.Nil(ginkgo.GinkgoT(), err, nil, "listing pluginConfigs") diff --git a/test/e2e/suite-plugins/suite-plugins-other/serverless.go b/test/e2e/suite-plugins/suite-plugins-other/serverless.go index 5ffe45297..bfe0b8eae 100644 --- a/test/e2e/suite-plugins/suite-plugins-other/serverless.go +++ b/test/e2e/suite-plugins/suite-plugins-other/serverless.go @@ -57,7 +57,8 @@ spec: err := s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusForbidden) @@ -86,7 +87,8 @@ spec: err := s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) diff --git a/test/e2e/suite-plugins/suite-plugins-security/consumer-restriction.go b/test/e2e/suite-plugins/suite-plugins-security/consumer-restriction.go index f54cd0c8a..5481a8290 100644 --- a/test/e2e/suite-plugins/suite-plugins-security/consumer-restriction.go +++ b/test/e2e/suite-plugins/suite-plugins-security/consumer-restriction.go @@ -90,7 +90,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar), "creating ApisixRoute with basicAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient().GET("/anything"). WithHeader("Host", "httpbin.org"). WithHeader("Authorization", "Basic amFjazEtdXNlcm5hbWU6amFjazEtcGFzc3dvcmQ="). @@ -184,7 +185,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), s.CreateVersionedApisixResource(ar), "creating ApisixRoute with basicAuth") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes") assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixUpstreamsCreated(1), "Checking number of upstreams") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient().GET("/anything"). WithHeader("Host", "httpbin.org"). WithHeader("Authorization", "Basic amFjazEtdXNlcm5hbWU6amFjazEtcGFzc3dvcmQ="). diff --git a/test/e2e/suite-plugins/suite-plugins-security/cors.go b/test/e2e/suite-plugins/suite-plugins-security/cors.go index 5ea8efe8f..36adb5af2 100644 --- a/test/e2e/suite-plugins/suite-plugins-security/cors.go +++ b/test/e2e/suite-plugins/suite-plugins-security/cors.go @@ -57,7 +57,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Header("Access-Control-Allow-Origin").Equal("*") @@ -104,7 +105,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("Origin", "http://foo.bar.org"). @@ -167,7 +169,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). WithHeader("Origin", "http://foo.bar.org"). @@ -236,7 +239,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) // httpbin sets this header by itself. @@ -277,7 +281,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) @@ -311,7 +316,8 @@ spec: // EnsureNumApisixRoutesCreated cannot be used to ensure update Correctness. time.Sleep(6 * time.Second) - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp = s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) diff --git a/test/e2e/suite-plugins/suite-plugins-security/csrf.go b/test/e2e/suite-plugins/suite-plugins-security/csrf.go index add22714e..7fac3e6ff 100644 --- a/test/e2e/suite-plugins/suite-plugins-security/csrf.go +++ b/test/e2e/suite-plugins/suite-plugins-security/csrf.go @@ -58,7 +58,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") msg401 := s.NewAPISIXClient(). POST("/anything"). WithHeader("Host", "httpbin.org"). @@ -118,7 +119,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient(). GET("/anything"). WithHeader("Host", "httpbin.org"). diff --git a/test/e2e/suite-plugins/suite-plugins-security/ip-restriction.go b/test/e2e/suite-plugins/suite-plugins-security/ip-restriction.go index a05c16f41..a3c29647e 100644 --- a/test/e2e/suite-plugins/suite-plugins-security/ip-restriction.go +++ b/test/e2e/suite-plugins/suite-plugins-security/ip-restriction.go @@ -60,7 +60,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // As we use port forwarding so the ip address is 127.0.0.1 s.NewAPISIXClient().GET("/hello").WithHeader("Host", "httpbin.org"). Expect(). @@ -99,7 +100,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // As we use port forwarding so the ip address is 127.0.0.1 s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org"). Expect(). @@ -140,7 +142,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // As we use port forwarding so the ip address is 127.0.0.1 s.NewAPISIXClient().GET("/hello").WithHeader("Host", "httpbin.org"). Expect(). @@ -177,7 +180,8 @@ spec: // EnsureNumApisixRoutesCreated cannot be used to ensure update Correctness. time.Sleep(6 * time.Second) - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // As we use port forwarding so the ip address is 127.0.0.1 s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org"). Expect(). @@ -219,7 +223,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // As we use port forwarding so the ip address is 127.0.0.1 s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org"). Expect(). diff --git a/test/e2e/suite-plugins/suite-plugins-security/referer-restriction.go b/test/e2e/suite-plugins/suite-plugins-security/referer-restriction.go index 3bf3cf27d..efe215bcc 100644 --- a/test/e2e/suite-plugins/suite-plugins-security/referer-restriction.go +++ b/test/e2e/suite-plugins/suite-plugins-security/referer-restriction.go @@ -61,7 +61,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // "Referer" match passed resp := s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). @@ -128,7 +129,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking the number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking the number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // "Referer" match failed resp := s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). @@ -196,7 +198,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking the number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking the number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // "Referer" match failed resp := s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). @@ -247,7 +250,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking the number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking the number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // "Referer" is missing resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) @@ -295,7 +299,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // "Referer" is not in the whitelist. resp := s.NewAPISIXClient().GET("/ip"). WithHeader("Host", "httpbin.org"). diff --git a/test/e2e/suite-plugins/suite-plugins-security/uri_blocker.go b/test/e2e/suite-plugins/suite-plugins-security/uri_blocker.go index 3bd751ba7..c5d97f3b1 100644 --- a/test/e2e/suite-plugins/suite-plugins-security/uri_blocker.go +++ b/test/e2e/suite-plugins/suite-plugins-security/uri_blocker.go @@ -65,7 +65,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/status/200").WithHeader("Host", "httpbin.org"). Expect(). Status(403) @@ -121,7 +122,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/status/200").WithHeader("Host", "httpbin.org"). Expect(). Status(200) @@ -180,7 +182,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/status/200").WithHeader("Host", "httpbin.org"). Expect(). Status(http.StatusForbidden) @@ -218,7 +221,8 @@ spec: // EnsureNumApisixRoutesCreated cannot be used to ensure update Correctness. time.Sleep(6 * time.Second) - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/status/200").WithHeader("Host", "httpbin.org"). Expect(). Status(http.StatusOK) diff --git a/test/e2e/suite-plugins/suite-plugins-traffic/api_breaker.go b/test/e2e/suite-plugins/suite-plugins-traffic/api_breaker.go index fc43d0540..afd9ae64b 100644 --- a/test/e2e/suite-plugins/suite-plugins-traffic/api_breaker.go +++ b/test/e2e/suite-plugins/suite-plugins-traffic/api_breaker.go @@ -67,7 +67,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/status/200").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) @@ -123,7 +124,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/status/200").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) diff --git a/test/e2e/suite-plugins/suite-plugins-traffic/client-control.go b/test/e2e/suite-plugins/suite-plugins-traffic/client-control.go index 044060dab..fb05ef2ab 100644 --- a/test/e2e/suite-plugins/suite-plugins-traffic/client-control.go +++ b/test/e2e/suite-plugins/suite-plugins-traffic/client-control.go @@ -58,7 +58,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient(). GET("/anything"). WithHeader("Host", "httpbin.org"). @@ -107,7 +108,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") _ = s.NewAPISIXClient(). GET("/anything"). WithHeader("Host", "httpbin.org"). diff --git a/test/e2e/suite-plugins/suite-plugins-traffic/limit_count.go b/test/e2e/suite-plugins/suite-plugins-traffic/limit_count.go index de36cece1..ca91762bc 100644 --- a/test/e2e/suite-plugins/suite-plugins-traffic/limit_count.go +++ b/test/e2e/suite-plugins/suite-plugins-traffic/limit_count.go @@ -62,7 +62,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org"). Expect(). Status(200). @@ -119,7 +120,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org"). Expect(). Status(200). @@ -172,7 +174,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org"). Expect(). Status(200). @@ -210,7 +213,8 @@ spec: // EnsureNumApisixRoutesCreated cannot be used to ensure update Correctness. time.Sleep(6 * time.Second) - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org"). Expect(). Status(200). diff --git a/test/e2e/suite-plugins/suite-plugins-traffic/request-validation.go b/test/e2e/suite-plugins/suite-plugins-traffic/request-validation.go index 9f9d69856..2ffcb5de6 100644 --- a/test/e2e/suite-plugins/suite-plugins-traffic/request-validation.go +++ b/test/e2e/suite-plugins/suite-plugins-traffic/request-validation.go @@ -73,6 +73,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // header schema check failure. resp := s.NewAPISIXClient().POST("/post").WithHeader("Host", "httpbin.org").WithHeader("User-Agent", "bad-ua").Expect() resp.Status(400) @@ -154,6 +156,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().POST("/post").WithHeader("Host", "httpbin.org").WithHeader("User-Agent", "bad-ua").Expect() resp.Status(200) diff --git a/test/e2e/suite-plugins/suite-plugins-traffic/request_id.go b/test/e2e/suite-plugins/suite-plugins-traffic/request_id.go index 3da70f219..8b400b832 100644 --- a/test/e2e/suite-plugins/suite-plugins-traffic/request_id.go +++ b/test/e2e/suite-plugins/suite-plugins-traffic/request_id.go @@ -58,7 +58,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(200) resp.Header("X-Request-Id").NotEmpty() @@ -96,7 +97,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(200) resp.Header("X-Request-Id").Empty() @@ -133,7 +135,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(200) resp.Header("X-Request-Id").NotEmpty() @@ -162,7 +165,8 @@ spec: // EnsureNumApisixRoutesCreated cannot be used to ensure update Correctness. time.Sleep(6 * time.Second) - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp = s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(200) resp.Header("X-Request-Id").Empty() diff --git a/test/e2e/suite-plugins/suite-plugins-transformation/fault_injection.go b/test/e2e/suite-plugins/suite-plugins-transformation/fault_injection.go index bf4148758..88238b4e4 100644 --- a/test/e2e/suite-plugins/suite-plugins-transformation/fault_injection.go +++ b/test/e2e/suite-plugins/suite-plugins-transformation/fault_injection.go @@ -64,7 +64,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // vars unsatisfied resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) @@ -109,7 +110,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // vars unsatisfied resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) @@ -157,7 +159,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // vars unsatisfied resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) @@ -199,7 +202,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithQuery("name", "bob").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusInternalServerError) @@ -226,7 +230,8 @@ spec: // EnsureNumApisixRoutesCreated cannot be used to ensure update Correctness. time.Sleep(6 * time.Second) - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp = s.NewAPISIXClient().GET("/ip").WithQuery("name", "bob").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().Contains("origin") diff --git a/test/e2e/suite-plugins/suite-plugins-transformation/proxy_rewrite.go b/test/e2e/suite-plugins/suite-plugins-transformation/proxy_rewrite.go index 502909555..320d5bde0 100644 --- a/test/e2e/suite-plugins/suite-plugins-transformation/proxy_rewrite.go +++ b/test/e2e/suite-plugins/suite-plugins-transformation/proxy_rewrite.go @@ -59,7 +59,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/hello").WithHeader("Host", "httpbin.org"). Expect(). Status(200). @@ -101,7 +102,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/hello").WithHeader("Host", "test.com"). Expect(). Status(200). @@ -144,7 +146,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/hello/ip"). Expect(). Status(200). @@ -187,7 +190,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/hello/ip"). Expect(). Status(404) @@ -225,7 +229,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") s.NewAPISIXClient().GET("/hello").WithHeader("Host", "httpbin.org"). Expect(). Status(404) diff --git a/test/e2e/suite-plugins/suite-plugins-transformation/response_rewrite.go b/test/e2e/suite-plugins/suite-plugins-transformation/response_rewrite.go index 94c3f662e..f450abb42 100644 --- a/test/e2e/suite-plugins/suite-plugins-transformation/response_rewrite.go +++ b/test/e2e/suite-plugins/suite-plugins-transformation/response_rewrite.go @@ -62,7 +62,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusMovedPermanently) resp.Header("Location").Equal("https://my.location/path") @@ -101,7 +102,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().Equal("hello\nworld") @@ -140,7 +142,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) resp.Body().Equal("hello\\nworld") @@ -185,7 +188,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") // vars unsatisfied resp := s.NewAPISIXClient().GET("/status/500").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusInternalServerError) @@ -231,7 +235,8 @@ spec: assert.Nil(ginkgo.GinkgoT(), err, "Checking number of upstreams") err = s.EnsureNumApisixRoutesCreated(1) assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes") - + //Check the status of ApisixRoute resource + s.AssertCRSync("httpbin-route", "ar", "Sync Successfully") resp := s.NewAPISIXClient().GET("/status/200").WithHeader("Host", "httpbin.org").Expect() resp.Status(http.StatusOK) })