Changed hardcoded testdata path
parent
a63e6c3633
commit
a9b18cdc94
|
@ -19,7 +19,6 @@ limitations under the License.
|
|||
package integration
|
||||
|
||||
import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
|
@ -114,11 +113,7 @@ func testGvisorRestart(t *testing.T) {
|
|||
|
||||
func createUntrustedWorkload(t *testing.T, profile string) {
|
||||
kr := util.NewKubectlRunner(t, profile)
|
||||
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")
|
||||
untrustedPath := filepath.Join(*testdataDir, "nginx-untrusted.yaml")
|
||||
t.Log("creating pod with untrusted workload annotation")
|
||||
if _, err := kr.RunCommand([]string{"replace", "-f", untrustedPath, "--force"}); err != nil {
|
||||
t.Fatalf("creating untrusted nginx resource: %v", err)
|
||||
|
@ -127,11 +122,7 @@ func createUntrustedWorkload(t *testing.T, profile string) {
|
|||
|
||||
func deleteUntrustedWorkload(t *testing.T, profile string) {
|
||||
kr := util.NewKubectlRunner(t, profile)
|
||||
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")
|
||||
untrustedPath := filepath.Join(*testdataDir, "nginx-untrusted.yaml")
|
||||
if _, err := kr.RunCommand([]string{"delete", "-f", untrustedPath}); err != nil {
|
||||
t.Logf("error deleting untrusted nginx resource: %v", err)
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -135,16 +134,12 @@ func testIngressController(t *testing.T) {
|
|||
t.Fatalf("waiting for default-http-backend to be up: %v", err)
|
||||
}
|
||||
|
||||
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")
|
||||
ingressPath := filepath.Join(*testdataDir, "nginx-ing.yaml")
|
||||
if _, err := kr.RunCommand([]string{"create", "-f", ingressPath}); err != nil {
|
||||
t.Fatalf("creating nginx ingress resource: %v", err)
|
||||
}
|
||||
|
||||
podPath := path.Join(curdir, "testdata", "nginx-pod-svc.yaml")
|
||||
podPath := filepath.Join(*testdataDir, "nginx-pod-svc.yaml")
|
||||
if _, err := kr.RunCommand([]string{"create", "-f", podPath}); err != nil {
|
||||
t.Fatalf("creating nginx ingress resource: %v", err)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
@ -63,12 +62,7 @@ func testMounting(t *testing.T) {
|
|||
|
||||
kr := util.NewKubectlRunner(t, p)
|
||||
podName := "busybox-mount"
|
||||
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")
|
||||
|
||||
podPath := filepath.Join(*testdataDir, "busybox-mount-test.yaml")
|
||||
// Write file in mounted dir from host
|
||||
expected := "test\n"
|
||||
if err := writeFilesFromHost(tempDir, []string{"fromhost", "fromhostremove"}, expected); err != nil {
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
"io/ioutil"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
@ -64,11 +63,7 @@ func testTunnel(t *testing.T) {
|
|||
kr := util.NewKubectlRunner(t, p)
|
||||
|
||||
t.Log("deploying nginx...")
|
||||
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")
|
||||
podPath := filepath.Join(*testdataDir, "testsvc.yaml")
|
||||
if _, err := kr.RunCommand([]string{"apply", "-f", podPath}); err != nil {
|
||||
t.Fatalf("creating nginx ingress resource: %s", err)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ limitations under the License.
|
|||
package integration
|
||||
|
||||
import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -35,50 +34,39 @@ func TestPersistence(t *testing.T) {
|
|||
} else {
|
||||
t.Parallel()
|
||||
}
|
||||
mk := NewMinikubeRunner(t, p, "--wait=false")
|
||||
mk := NewMinikubeRunner(t, p)
|
||||
if isTestNoneDriver() {
|
||||
t.Skip("skipping test as none driver does not support persistence")
|
||||
}
|
||||
mk.EnsureRunning()
|
||||
|
||||
kr := util.NewKubectlRunner(t, p)
|
||||
curdir, err := filepath.Abs("")
|
||||
if err != nil {
|
||||
t.Errorf("Error getting the file path for current directory: %s", curdir)
|
||||
}
|
||||
// TODO change all testdata path to get from flag vs hardcode
|
||||
podPath := path.Join(curdir, "testdata", "busybox.yaml")
|
||||
|
||||
// Create a pod and wait for it to be running.
|
||||
if _, err := kr.RunCommand([]string{"create", "-f", podPath}); err != nil {
|
||||
t.Fatalf("Error creating test pod: %v", err)
|
||||
if _, err := kr.RunCommand([]string{"create", "-f", filepath.Join(*testdataDir, "busybox.yaml")}); err != nil {
|
||||
t.Fatalf("creating busybox pod: %s", err)
|
||||
}
|
||||
|
||||
verify := func(t *testing.T) {
|
||||
verifyBusybox := func(t *testing.T) {
|
||||
if err := util.WaitForBusyboxRunning(t, "default", p); err != nil {
|
||||
t.Fatalf("waiting for busybox to be up: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Make sure everything is up before we stop.
|
||||
verify(t)
|
||||
verifyBusybox(t)
|
||||
|
||||
// Now restart minikube and make sure the pod is still there.
|
||||
// mk.RunCommand("stop", true)
|
||||
// mk.CheckStatus("Stopped")
|
||||
checkStop := func() error {
|
||||
mk.RunCommand("stop", true)
|
||||
mk.RunCommand("stop", false)
|
||||
return mk.CheckStatusNoFail(state.Stopped.String())
|
||||
}
|
||||
|
||||
if err := util.Retry(t, checkStop, 5*time.Second, 6); err != nil {
|
||||
t.Fatalf("timed out while checking stopped status: %v", err)
|
||||
t.Fatalf("TestPersistence Failed to stop minikube : %v", err)
|
||||
}
|
||||
|
||||
mk.Start()
|
||||
mk.CheckStatus(state.Running.String())
|
||||
|
||||
// Make sure the same things come up after we've restarted.
|
||||
verify(t)
|
||||
verifyBusybox(t)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue