AlinsRan commented on code in PR #1103:
URL:
https://github.com/apache/apisix-ingress-controller/pull/1103#discussion_r911690300
##########
test/e2e/suite-ingress/resourcesync.go:
##########
@@ -132,96 +123,120 @@ spec:
}
}
}`, consumer.Username)))
- }
+ }
+
+ _ = s.NewAPISIXClient().
+ GET("/ip").
+ WithHeader("Host", "httpbin.org").
+ Expect().
+ Status(http.StatusNotFound)
+
+ _ = s.NewAPISIXClient().
+ GET("/headers").
+ WithHeader("Host", "local.httpbin.org").
+ Expect().
+ Status(http.StatusNotFound)
+
+ waitTime := time.Until(readyTime).Seconds()
+ time.Sleep(time.Duration(waitTime) * time.Second)
+
+ _ = s.NewAPISIXClient().
+ GET("/ip").
+ WithHeader("Host", "httpbin.org").
+ WithHeader("apikey", "foo-key").
+ Expect().
+ Status(http.StatusOK)
+
+ _ = s.NewAPISIXClient().
+ GET("/headers").
+ WithHeader("Host", "local.httpbin.org").
+ Expect().
+ Status(http.StatusOK)
+
+ consumers, _ = s.ListApisixConsumers()
+ assert.Len(ginkgo.GinkgoT(), consumers, 1)
+ data, _ := json.Marshal(consumers[0])
+ assert.Contains(ginkgo.GinkgoT(), string(data),
"foo-key")
+ })
+
+ ginkgo.It("for deleted resource sync consistency", func() {
+ // crd resource sync interval
+ readyTime := time.Now().Add(60 * time.Second)
+
+ routes, _ := s.ListApisixRoutes()
+ assert.Len(ginkgo.GinkgoT(), routes, 2)
+
+ consumers, _ := s.ListApisixConsumers()
+ assert.Len(ginkgo.GinkgoT(), consumers, 1)
+
+ for _, route := range routes {
+ _ =
s.DeleteApisixRouteByApisixAdmin(id.GenID(route.Name))
+ }
+
+ for _, consumer := range consumers {
+
s.DeleteApisixConsumerByApisixAdmin(consumer.Username)
+ }
+
+ _ = s.NewAPISIXClient().
+ GET("/ip").
+ WithHeader("Host", "httpbin.org").
+ Expect().
+ Status(http.StatusNotFound)
+
+ _ = s.NewAPISIXClient().
+ GET("/headers").
+ WithHeader("Host", "local.httpbin.org").
+ Expect().
+ Status(http.StatusNotFound)
+
+ routes, _ = s.ListApisixRoutes()
+ assert.Len(ginkgo.GinkgoT(), routes, 0)
+ consumers, _ = s.ListApisixConsumers()
+ assert.Len(ginkgo.GinkgoT(), consumers, 0)
+
+ waitTime := time.Until(readyTime).Seconds()
+ time.Sleep(time.Duration(waitTime) * time.Second)
+
+ _ = s.NewAPISIXClient().
+ GET("/ip").
+ WithHeader("Host", "httpbin.org").
+ WithHeader("apikey", "foo-key").
+ Expect().
+ Status(http.StatusOK)
+
+ _ = s.NewAPISIXClient().
+ GET("/headers").
+ WithHeader("Host", "local.httpbin.org").
+ Expect().
+ Status(http.StatusOK)
+
+ consumers, _ = s.ListApisixConsumers()
+ assert.Len(ginkgo.GinkgoT(), consumers, 1)
+ data, _ := json.Marshal(consumers[0])
+ assert.Contains(ginkgo.GinkgoT(), string(data),
"foo-key")
+ })
+ }
- _ = s.NewAPISIXClient().
- GET("/ip").
- WithHeader("Host", "httpbin.org").
- Expect().
- Status(http.StatusNotFound)
-
- _ = s.NewAPISIXClient().
- GET("/headers").
- WithHeader("Host", "local.httpbin.org").
- Expect().
- Status(http.StatusNotFound)
-
- waitTime := time.Until(readyTime).Seconds()
- time.Sleep(time.Duration(waitTime) * time.Second)
-
- _ = s.NewAPISIXClient().
- GET("/ip").
- WithHeader("Host", "httpbin.org").
- WithHeader("apikey", "foo-key").
- Expect().
- Status(http.StatusOK)
-
- _ = s.NewAPISIXClient().
- GET("/headers").
- WithHeader("Host", "local.httpbin.org").
- Expect().
- Status(http.StatusOK)
-
- consumers, _ = s.ListApisixConsumers()
- assert.Len(ginkgo.GinkgoT(), consumers, 1)
- data, _ := json.Marshal(consumers[0])
- assert.Contains(ginkgo.GinkgoT(), string(data), "foo-key")
+ ginkgo.Describe("suite-ingress: scaffold v2beta3", func() {
+ suites(scaffold.NewScaffold(&scaffold.Options{
+ Name: "sync",
+ Kubeconfig: scaffold.GetKubeconfig(),
+ APISIXConfigPath:
"testdata/apisix-gw-config.yaml",
+ IngressAPISIXReplicas: 1,
+ HTTPBinServicePort: 80,
+ ApisixResourceVersion:
scaffold.ApisixResourceVersion().V2beta3,
+ ApisixResourceSyncInterval: "60s",
+ }))
Review Comment:
Separate configuration item `ApisixResourceSyncInterval: "60s"` are used
here.
--
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]