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


##########
test/e2e/suite-chore/consistency.go:
##########
@@ -273,3 +275,57 @@ var _ = ginkgo.Describe("suite-chore: Consistency between 
APISIX and the Ingress
                s.NewAPISIXClient().GET("/ip").WithHeader("Host", 
"httpbin.org").Expect().Status(http.StatusOK)
        })
 })
+
+var _ = ginkgo.Describe("suite-chore: 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/v2
+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
+`, 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)
+                       }
+                       // cleanup
+                       for _, route := range routes {
+                               _ = 
s.DeleteApisixRouteByApisixAdmin(id.GenID(route.Name))
+                       }
+                       // confirm deletion

Review Comment:
   @AlinsRan should I write code for thread sleep to wait for deletion?



##########
test/e2e/suite-chore/consistency.go:
##########
@@ -273,3 +275,57 @@ var _ = ginkgo.Describe("suite-chore: Consistency between 
APISIX and the Ingress
                s.NewAPISIXClient().GET("/ip").WithHeader("Host", 
"httpbin.org").Expect().Status(http.StatusOK)
        })
 })
+
+var _ = ginkgo.Describe("suite-chore: 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/v2
+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
+`, 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)
+                       }
+                       // cleanup

Review Comment:
   @AlinsRan is clean up after tests necessary?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to