You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/12/22 02:43:33 UTC

[GitHub] [apisix-ingress-controller] AlinsRan commented on a diff in pull request #1526: feat: sync crd labels to apisix

AlinsRan commented on code in PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526#discussion_r1055033086


##########
test/e2e/suite-ingress/suite-ingress-features/resourcesync.go:
##########
@@ -320,3 +321,54 @@ spec:
 		}))
 	})
 })
+
+var _ = ginkgo.Describe("suite-ingress-features: apisix labels sync", func() {
+	suites := func(s *scaffold.Scaffold) {
+		ginkgo.JustBeforeEach(func() {
+			labels := map[string]string{"key": "value", "foo": "bar"}
+			backendSvc, backendPorts := s.DefaultHTTPBackend()
+			ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+   key: value
+   foo: bar
+spec:
+ http:
+ - name: rule1
+   match:
+     hosts:
+     - httpbin.org
+     paths:
+       - /ip
+   backends:
+   - serviceName: %s
+     servicePort: %d
+   authentication:
+     enable: true
+     type: keyAuth
+`, backendSvc, backendPorts[0])
+			assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar))
+			assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes")
+
+			routes, _ := s.ListApisixRoutes()
+			assert.Len(ginkgo.GinkgoT(), routes, 1)
+			// check if labels exists
+			for _, route := range routes {
+				eq := reflect.DeepEqual(route.Metadata.Labels, labels)
+				assert.True(ginkgo.GinkgoT(), eq)
+			}
+		})
+	}
+
+	ginkgo.Describe("suite-ingress-features: scaffold v2", func() {
+		suites(scaffold.NewScaffold(&scaffold.Options{

Review Comment:
   Please refer to it https://github.com/apache/apisix-ingress-controller/blob/master/test/e2e/suite-chore/admin_api.go#L29.
   `ApisixResourceSyncInterval` is not required here.
   
   
   



##########
test/e2e/suite-ingress/suite-ingress-features/resourcesync.go:
##########
@@ -320,3 +321,54 @@ spec:
 		}))
 	})
 })
+
+var _ = ginkgo.Describe("suite-ingress-features: apisix labels sync", func() {
+	suites := func(s *scaffold.Scaffold) {
+		ginkgo.JustBeforeEach(func() {
+			labels := map[string]string{"key": "value", "foo": "bar"}
+			backendSvc, backendPorts := s.DefaultHTTPBackend()
+			ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+   key: value
+   foo: bar
+spec:
+ http:
+ - name: rule1
+   match:
+     hosts:
+     - httpbin.org
+     paths:
+       - /ip
+   backends:
+   - serviceName: %s
+     servicePort: %d
+   authentication:

Review Comment:
   Please remove authentication, it is not used.



##########
test/e2e/suite-ingress/suite-ingress-features/resourcesync.go:
##########
@@ -320,3 +321,54 @@ spec:
 		}))
 	})
 })
+
+var _ = ginkgo.Describe("suite-ingress-features: apisix labels sync", func() {
+	suites := func(s *scaffold.Scaffold) {
+		ginkgo.JustBeforeEach(func() {
+			labels := map[string]string{"key": "value", "foo": "bar"}
+			backendSvc, backendPorts := s.DefaultHTTPBackend()
+			ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta3

Review Comment:
   `apiVersion: apisix.apache.org/v2`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org