未验证 提交 53e8f9d4 编写于 作者: S Sharif Elgamal 提交者: GitHub

Merge pull request #4434 from medyagh/4433_filepath

Fixing file path for windows
......@@ -25,6 +25,7 @@ import (
"net"
"net/http"
"net/url"
"path"
"path/filepath"
"strings"
"testing"
......@@ -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)
}
......@@ -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)
......@@ -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)
}
......
......@@ -22,6 +22,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"runtime"
"strings"
......@@ -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"
......
......@@ -19,6 +19,7 @@ limitations under the License.
package integration
import (
"path"
"path/filepath"
"strings"
"testing"
......@@ -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 {
......
......@@ -21,6 +21,7 @@ import (
"io/ioutil"
"net/http"
"os/exec"
"path"
"path/filepath"
"runtime"
"strings"
......@@ -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)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册