Add unit test for staging path creation

This commit is contained in:
Jan Safranek 2020-11-09 19:08:20 +01:00
parent 8d5c65b8cd
commit 55ffd9d5fc

View File

@ -1236,6 +1236,18 @@ func TestAttacherMountDevice(t *testing.T) {
t.Errorf("expected mount options: %v, got: %v", tc.spec.PersistentVolume.Spec.MountOptions, vol.MountFlags)
}
}
// Verify the deviceMountPath was created by the plugin
if tc.stageUnstageSet {
s, err := os.Stat(tc.deviceMountPath)
if err != nil {
t.Errorf("expected staging directory %s to be created and be a directory, got error: %s", tc.deviceMountPath, err)
} else {
if !s.IsDir() {
t.Errorf("expected staging directory %s to be directory, got something else", tc.deviceMountPath)
}
}
}
})
}
}