From 6c73183ceaef3ff022f5b321addb87195c4f368c Mon Sep 17 00:00:00 2001 From: Matt Rickard Date: Wed, 23 Aug 2017 08:52:15 -0700 Subject: [PATCH] Add target for none driver integration Theres currently no good way to run the integration tests for the none driver locally. Now that we've added the e2e target, we can depend on that. Running the e2e test binary locally requires the testdata folder to be in a different path, since it is relative to where the code is being ran. I added a testdata-dir flag to the integration tests so we can set it appropriately for when we want to run the e2e binary by itself. I also made the e2e test binary a PHONY target, so we rebuild it each time. I had trouble collecting the dependencies on the integration test packages --- Makefile | 4 ++++ test/integration/cluster_dns_test.go | 2 +- test/integration/flags.go | 1 + test/integration/pv_test.go | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 94683644bd..3fb0c14e97 100644 --- a/Makefile +++ b/Makefile @@ -142,6 +142,10 @@ test-iso: integration: out/minikube go test -v -test.timeout=30m $(REPOPATH)/test/integration --tags=integration --minikube-args="$(MINIKUBE_ARGS)" +.PHONY: integration-none-driver +integration-none-driver: e2e-linux-amd64 out/minikube-linux-amd64 + sudo -E out/e2e-linux-amd64 -testdata-dir "test/integration/testdata" -minikube-args="--vm-driver=none --alsologtostderr" -test.v -test.timeout=30m -binary=out/minikube-linux-amd64 + .PHONY: integration-versioned integration-versioned: out/minikube go test -v -test.timeout=30m $(REPOPATH)/test/integration --tags="integration versioned" --minikube-args="$(MINIKUBE_ARGS)" diff --git a/test/integration/cluster_dns_test.go b/test/integration/cluster_dns_test.go index 87f9cc73cd..b2a94612b1 100644 --- a/test/integration/cluster_dns_test.go +++ b/test/integration/cluster_dns_test.go @@ -34,7 +34,7 @@ func testClusterDNS(t *testing.T) { kubectlRunner := util.NewKubectlRunner(t) podName := "busybox" - podPath, _ := filepath.Abs("testdata/busybox.yaml") + podPath := filepath.Join(*testdataDir, "busybox.yaml") defer kubectlRunner.RunCommand([]string{"delete", "-f", podPath}) if _, err := kubectlRunner.RunCommand([]string{"create", "-f", podPath}); err != nil { diff --git a/test/integration/flags.go b/test/integration/flags.go index 2cb59e834f..7f856bff52 100644 --- a/test/integration/flags.go +++ b/test/integration/flags.go @@ -29,3 +29,4 @@ func TestMain(m *testing.M) { var binaryPath = flag.String("binary", "../../out/minikube", "path to minikube binary") var args = flag.String("minikube-args", "", "Arguments to pass to minikube") +var testdataDir = flag.String("testdata-dir", "testdata", "the directory relative to test/integration where the testdata lives") diff --git a/test/integration/pv_test.go b/test/integration/pv_test.go index 48c5e0fe43..29c8013d10 100644 --- a/test/integration/pv_test.go +++ b/test/integration/pv_test.go @@ -59,7 +59,7 @@ func testProvisioning(t *testing.T) { } // Now create the PVC - pvcPath, _ := filepath.Abs("testdata/pvc.yaml") + pvcPath := filepath.Join(*testdataDir, "pvc.yaml") if _, err := kubectlRunner.RunCommand([]string{"create", "-f", pvcPath}); err != nil { t.Fatalf("Error creating pvc") }