Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing file path for windows #4434

Merged
merged 2 commits into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions test/integration/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"net"
"net/http"
"net/url"
"path"
"path/filepath"
"strings"
"testing"
Expand Down Expand Up @@ -131,12 +132,16 @@ func testIngressController(t *testing.T) {
t.Fatalf("waiting for default-http-backend to be up: %v", err)
}

ingressPath, _ := filepath.Abs("testdata/nginx-ing.yaml")
curdir, err := filepath.Abs("")
if err != nil {
t.Errorf("Error getting the file path for current directory: %s", curdir)
}
ingressPath := path.Join(curdir, "testdata", "nginx-ing.yaml")
if _, err := kubectlRunner.RunCommand([]string{"create", "-f", ingressPath}); err != nil {
t.Fatalf("creating nginx ingress resource: %v", err)
}

podPath, _ := filepath.Abs("testdata/nginx-pod-svc.yaml")
podPath := path.Join(curdir, "testdata", "nginx-pod-svc.yaml")
if _, err := kubectlRunner.RunCommand([]string{"create", "-f", podPath}); err != nil {
t.Fatalf("creating nginx ingress resource: %v", err)
}
Expand Down Expand Up @@ -248,7 +253,11 @@ func testGvisorRestart(t *testing.T) {

func createUntrustedWorkload(t *testing.T) {
kubectlRunner := util.NewKubectlRunner(t)
untrustedPath, _ := filepath.Abs("testdata/nginx-untrusted.yaml")
curdir, err := filepath.Abs("")
if err != nil {
t.Errorf("Error getting the file path for current directory: %s", curdir)
}
untrustedPath := path.Join(curdir, "testdata", "nginx-untrusted.yaml")
t.Log("creating pod with untrusted workload annotation")
if _, err := kubectlRunner.RunCommand([]string{"replace", "-f", untrustedPath, "--force"}); err != nil {
t.Fatalf("creating untrusted nginx resource: %v", err)
Expand All @@ -257,7 +266,11 @@ func createUntrustedWorkload(t *testing.T) {

func deleteUntrustedWorkload(t *testing.T) {
kubectlRunner := util.NewKubectlRunner(t)
untrustedPath, _ := filepath.Abs("testdata/nginx-untrusted.yaml")
curdir, err := filepath.Abs("")
if err != nil {
t.Errorf("Error getting the file path for current directory: %s", curdir)
}
untrustedPath := path.Join(curdir, "testdata", "nginx-untrusted.yaml")
if _, err := kubectlRunner.RunCommand([]string{"delete", "-f", untrustedPath}); err != nil {
t.Logf("error deleting untrusted nginx resource: %v", err)
}
Expand Down
7 changes: 6 additions & 1 deletion test/integration/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -61,7 +62,11 @@ func testMounting(t *testing.T) {

kubectlRunner := util.NewKubectlRunner(t)
podName := "busybox-mount"
podPath, _ := filepath.Abs("testdata/busybox-mount-test.yaml")
curdir, err := filepath.Abs("")
if err != nil {
t.Errorf("Error getting the file path for current directory: %s", curdir)
}
podPath := path.Join(curdir, "testdata", "busybox-mount-test.yaml")

// Write file in mounted dir from host
expected := "test\n"
Expand Down
7 changes: 6 additions & 1 deletion test/integration/persistence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ limitations under the License.
package integration

import (
"path"
"path/filepath"
"strings"
"testing"
Expand All @@ -36,7 +37,11 @@ func TestPersistence(t *testing.T) {
minikubeRunner.EnsureRunning()

kubectlRunner := util.NewKubectlRunner(t)
podPath, _ := filepath.Abs("testdata/busybox.yaml")
curdir, err := filepath.Abs("")
if err != nil {
t.Errorf("Error getting the file path for current directory: %s", curdir)
}
podPath := path.Join(curdir, "testdata", "busybox.yaml")

// Create a pod and wait for it to be running.
if _, err := kubectlRunner.RunCommand([]string{"create", "-f", podPath}); err != nil {
Expand Down
7 changes: 6 additions & 1 deletion test/integration/tunnel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"io/ioutil"
"net/http"
"os/exec"
"path"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -62,7 +63,11 @@ func testTunnel(t *testing.T) {
kubectlRunner := util.NewKubectlRunner(t)

t.Log("deploying nginx...")
podPath, _ := filepath.Abs("testdata/testsvc.yaml")
curdir, err := filepath.Abs("")
if err != nil {
t.Errorf("Error getting the file path for current directory: %s", curdir)
}
podPath := path.Join(curdir, "testdata", "testsvc.yaml")
if _, err := kubectlRunner.RunCommand([]string{"apply", "-f", podPath}); err != nil {
t.Fatalf("creating nginx ingress resource: %s", err)
}
Expand Down