From 2d804f3b9110c91601f003b3e59d1892dbf3857d Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Thu, 4 Jun 2020 22:47:08 -0700 Subject: [PATCH] windows literal --- .github/workflows/pr.yml | 6 ++---- test/integration/fn_tunnel_cmd.go | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c5c5993da..c8404578c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -208,12 +208,10 @@ jobs: continue-on-error: true shell: powershell run: | - $ErrorActionPreference = "SilentlyContinue" (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 - $DockerKubectl = "C:\Program Files\Docker\Docker\resources\bin\kubectl.exe" - if (Test-Path $DockerKubectl) { Remove-Item $DockerKubectl} + if (Test-Path 'C:\Program Files\Docker\Docker\resources\bin\kubectl.exe') { Remove-Item 'C:\Program Files\Docker\Docker\resources\bin\kubectl.exe'}; - name: Run Integration Test in powershell continue-on-error: true shell: powershell @@ -324,7 +322,7 @@ 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" + if (Test-Path 'C:\Program Files\Docker\Docker\resources\bin\kubectl.exe') { Remove-Item 'C:\Program Files\Docker\Docker\resources\bin\kubectl.exe'}; - 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 836d6e4cc..1d676fc3d 100644 --- a/test/integration/fn_tunnel_cmd.go +++ b/test/integration/fn_tunnel_cmd.go @@ -152,8 +152,10 @@ func validateServiceStable(ctx context.Context, t *testing.T, profile string) { // 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}") + // https://kubernetes.io/docs/reference/kubectl/jsonpath/ + // On Windows, you must use a single quote or escaped double quote around any literals in the template. 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}") + 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 { -- GitLab