未验证 提交 cba331b9 编写于 作者: M Medya Gh

add sub test for external ip

上级 00e25643
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册