From 65ead1950f7e1338b1b7f074a6c50d03f6e9760f Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Thu, 28 Jun 2018 17:01:43 +0800 Subject: [PATCH 1/2] run test TestAttacherMountDevice in temp directory --- pkg/volume/csi/csi_attacher_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/volume/csi/csi_attacher_test.go b/pkg/volume/csi/csi_attacher_test.go index e31cecfa6f..cfa9aa2b8b 100644 --- a/pkg/volume/csi/csi_attacher_test.go +++ b/pkg/volume/csi/csi_attacher_test.go @@ -541,6 +541,10 @@ func TestAttacherMountDevice(t *testing.T) { csiAttacher := attacher.(*csiAttacher) csiAttacher.csiClient = setupClient(t, tc.stageUnstageSet) + if tc.deviceMountPath != "" { + tc.deviceMountPath = filepath.Join(tmpDir, tc.deviceMountPath) + } + nodeName := string(csiAttacher.plugin.host.GetNodeName()) // Create spec From a9525c8c0ab3c5bb40d6211671505cb4b9d0b91a Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Fri, 29 Jun 2018 10:20:45 +0800 Subject: [PATCH 2/2] fix unit test TestAttacherUnmountDevice Before this test such command fails: ``` make test WHAT=k8s.io/kubernetes/pkg/volume/csi KUBE_TEST_ARGS='-run ^TestAttacherUnmountDevice$' ``` --- pkg/volume/csi/csi_attacher_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/volume/csi/csi_attacher_test.go b/pkg/volume/csi/csi_attacher_test.go index cfa9aa2b8b..f0525db6b7 100644 --- a/pkg/volume/csi/csi_attacher_test.go +++ b/pkg/volume/csi/csi_attacher_test.go @@ -653,6 +653,8 @@ func TestAttacherUnmountDevice(t *testing.T) { }, { testName: "stage_unstage not set no vars should not fail", + deviceMountPath: "plugins/csi/pv/test-pv-name/globalmount", + jsonFile: `{"driverName":"test-driver","volumeHandle":"test-vol1"}`, stageUnstageSet: false, }, }