tokers commented on a change in pull request #753:
URL:
https://github.com/apache/apisix-ingress-controller/pull/753#discussion_r747372786
##########
File path: test/e2e/scaffold/k8s.go
##########
@@ -467,3 +470,30 @@ func (s *Scaffold) newAPISIXTunnels() error {
func (s *Scaffold) Namespace() string {
return s.kubectlOptions.Namespace
}
+
+func (s *Scaffold) EnsureNumEndpointsReady(t testing.TestingT, endpointsName
string, desired int) {
+ e, err := k8s.GetKubernetesClientFromOptionsE(t, s.kubectlOptions)
+ assert.Nil(t, err, "get kubernetes client")
+ statusMsg := fmt.Sprintf("Wait for endpoints %s to be ready.",
endpointsName)
+ message := retry.DoWithRetry(
+ t,
+ statusMsg,
+ 20,
+ 5*time.Second,
+ func() (string, error) {
+ endpoints, err :=
e.CoreV1().Endpoints(s.Namespace()).Get(context.Background(), endpointsName,
metav1.GetOptions{})
+ if err != nil {
+ return "", err
+ }
+ readyNum := 0
+ for _, subset := range endpoints.Subsets {
+ readyNum += len(subset.Addresses)
+ }
+ if readyNum == desired {
+ return "Service is now available", nil
+ }
+ return "Endpoints not ready yet", nil
Review comment:
Add the expected number and the actual number to the message, it's
useful to troubleshoot issues.
--
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]