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/23 04:12:00 UTC

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

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


##########
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:
   The purpose of this use case is to verify that the labels are consistent. I don't think there's a point in verifying deletion.



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