diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d171b764e874c088f447442fe8a1cc0c809147d4..c5c5993da3584a200af187abdf76672bf901a8ed 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -212,7 +212,8 @@ jobs: (New-Object Net.WebClient).DownloadFile("https://github.com/medyagh/gopogh/releases/download/v0.1.23/gopogh.exe", "C:\ProgramData\chocolatey\bin\gopogh.exe") choco install -y kubernetes-cli choco install -y jq - Remove-Item "C:\Program Files\Docker\Docker\resources\bin\kubectl.exe" + $DockerKubectl = "C:\Program Files\Docker\Docker\resources\bin\kubectl.exe" + if (Test-Path $DockerKubectl) { Remove-Item $DockerKubectl} - name: Run Integration Test in powershell continue-on-error: true shell: powershell diff --git a/test/integration/fn_tunnel_cmd.go b/test/integration/fn_tunnel_cmd.go index f9fa20afa24fb7e6bcafb044d746d7770fa8d57a..836d6e4cceb0e7db58931d2a328b4417a76cb664 100644 --- a/test/integration/fn_tunnel_cmd.go +++ b/test/integration/fn_tunnel_cmd.go @@ -148,32 +148,37 @@ func validateServiceStable(ctx context.Context, t *testing.T, profile string) { t.Fatal(errors.Wrap(err, "Error waiting for nginx service to be up")) } - // Wait until the nginx-svc has a loadbalancer ingress IP - err = wait.PollImmediate(1*time.Second, Minutes(4), func() (bool, error) { - cmd := exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "svc", "nginx-svc", "-o", "jsonpath={.status.loadBalancer.ingress[0].ip}") - rr, err := Run(t, cmd) + t.Run("WaitForExternalIP", func(t *testing.T) { + // Wait until the nginx-svc has a loadbalancer ingress IP + err = wait.PollImmediate(3*time.Second, Minutes(4), func() (bool, error) { + cmd := exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "svc", "nginx-svc", "-o", "jsonpath={.status.loadBalancer.ingress[0].ip}") + if runtime.GOOS == "windows" { + cmd = exec.CommandContext(ctx, "powershell.exe", "-NoProfile", "-NonInteractive", "kubectl --context "+profile+" get svc nginx-svc -o jsonpath={.status.loadBalancer.ingress[0].ip}") + } + rr, err := Run(t, cmd) + if err != nil { + return false, err + } + if len(rr.Stdout.String()) > 0 { + hostname = rr.Stdout.String() + return true, nil + } + return false, nil + }) if err != nil { - return false, err + t.Errorf("nginx-svc svc.status.loadBalancer.ingress never got an IP: %v", err) + cmd := exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "svc", "nginx-svc") + if runtime.GOOS == "windows" { + cmd = exec.CommandContext(ctx, "powershell.exe", "-NoProfile", "-NonInteractive", "kubectl --context "+profile+" get svc nginx-svc") + } + + rr, err := Run(t, cmd) + if err != nil { + t.Errorf("%s failed: %v", rr.Command(), err) + } + t.Logf("failed to kubectl get svc nginx-svc:\n%s", rr.Output()) } - if len(rr.Stdout.String()) > 0 { - hostname = rr.Stdout.String() - return true, nil - } - return false, nil }) - if err != nil { - t.Errorf("nginx-svc svc.status.loadBalancer.ingress never got an IP: %v", err) - cmd := exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "svc", "nginx-svc") - if runtime.GOOS == "windows" { - cmd = exec.CommandContext(ctx, "powershell.exe", "-NoProfile", "-NonInteractive", "kubectl --context "+profile+" get svc nginx-svc") - } - - rr, err := Run(t, cmd) - if err != nil { - t.Errorf("%s failed: %v", rr.Command(), err) - } - t.Logf("failed to kubectl get svc nginx-svc:\n%s", rr.Stdout) - } } // validateAccessDirect validates if the test service can be accessed with LoadBalancer IP from host