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 06:43:58 UTC

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

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


##########
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:
   I added them just in case they are needed, I'll remove them once you review this.



-- 
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