fix tunnel integration tests for driver None (#4105)
* added more wait to the integration tests for the tunnelpull/4152/head^2
parent
6de90ae765
commit
3ebb16c678
|
@ -27,6 +27,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/minikube/pkg/minikube/tunnel"
|
||||
|
@ -76,7 +78,7 @@ func testTunnel(t *testing.T) {
|
|||
t.Fatal(errors.Wrap(err, "waiting for nginx pods"))
|
||||
}
|
||||
|
||||
if err := commonutil.WaitForService(client, "default", "nginx-svc", true, time.Millisecond*500, time.Minute*10); err != nil {
|
||||
if err := commonutil.WaitForService(client, "default", "nginx-svc", true, 1*time.Second, 2*time.Minute); err != nil {
|
||||
t.Fatal(errors.Wrap(err, "Error waiting for nginx service to be up"))
|
||||
}
|
||||
|
||||
|
@ -84,18 +86,34 @@ func testTunnel(t *testing.T) {
|
|||
|
||||
nginxIP := ""
|
||||
|
||||
for i := 1; i < 3 && len(nginxIP) == 0; i++ {
|
||||
stdout, err := kubectlRunner.RunCommand([]string{"get", "svc", "nginx-svc", "-o", "jsonpath={.status.loadBalancer.ingress[0].ip}"})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("error listing nginx service: %s", err)
|
||||
err = wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
|
||||
cmd := []string{"get", "svc", "nginx-svc", "-o", "jsonpath={.status.loadBalancer.ingress[0].ip}"}
|
||||
stdout, err := kubectlRunner.RunCommand(cmd)
|
||||
switch {
|
||||
case err == nil:
|
||||
nginxIP = string(stdout)
|
||||
return len(stdout) != 0, nil
|
||||
case !commonutil.IsRetryableAPIError(err):
|
||||
t.Errorf("`%s` failed with non retriable error: %v", cmd, err)
|
||||
return false, err
|
||||
default:
|
||||
t.Errorf("`%s` failed: %v", cmd, err)
|
||||
return false, nil
|
||||
}
|
||||
nginxIP = string(stdout)
|
||||
time.Sleep(1 * time.Second)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("error getting ingress IP for nginx: %s", err)
|
||||
}
|
||||
|
||||
if len(nginxIP) == 0 {
|
||||
t.Fatal("svc should have ingress after tunnel is created, but it was empty!")
|
||||
stdout, err := kubectlRunner.RunCommand([]string{"get", "svc", "nginx-svc", "-o", "jsonpath={.status}"})
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("error debugging nginx service: %s", err)
|
||||
}
|
||||
|
||||
t.Fatalf("svc should have ingress after tunnel is created, but it was empty! Result of `kubectl describe svc nginx-svc`:\n %s", string(stdout))
|
||||
}
|
||||
|
||||
responseBody, err := getResponseBody(nginxIP)
|
||||
|
|
Loading…
Reference in New Issue