mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Move unmount volume util from pkg/volume/util to pkg/util/mount
This commit is contained in:
@@ -22,16 +22,14 @@ import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
utiltesting "k8s.io/client-go/util/testing"
|
||||
|
||||
// util.go uses api.Codecs.LegacyCodec so import this package to do some
|
||||
// resource initialization.
|
||||
"hash/fnv"
|
||||
|
||||
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -354,45 +352,6 @@ func TestZonesToSet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDoUnmountMountPoint(t *testing.T) {
|
||||
|
||||
tmpDir1, err1 := utiltesting.MkTmpdir("umount_test1")
|
||||
if err1 != nil {
|
||||
t.Fatalf("error creating temp dir: %v", err1)
|
||||
}
|
||||
defer os.RemoveAll(tmpDir1)
|
||||
|
||||
tmpDir2, err2 := utiltesting.MkTmpdir("umount_test2")
|
||||
if err2 != nil {
|
||||
t.Fatalf("error creating temp dir: %v", err2)
|
||||
}
|
||||
defer os.RemoveAll(tmpDir2)
|
||||
|
||||
// Second part: want no error
|
||||
tests := []struct {
|
||||
mountPath string
|
||||
corruptedMnt bool
|
||||
}{
|
||||
{
|
||||
mountPath: tmpDir1,
|
||||
corruptedMnt: true,
|
||||
},
|
||||
{
|
||||
mountPath: tmpDir2,
|
||||
corruptedMnt: false,
|
||||
},
|
||||
}
|
||||
|
||||
fake := &mount.FakeMounter{}
|
||||
|
||||
for _, tt := range tests {
|
||||
err := doUnmountMountPoint(tt.mountPath, fake, false, tt.corruptedMnt)
|
||||
if err != nil {
|
||||
t.Errorf("err Expected nil, but got: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCalculateTimeoutForVolume(t *testing.T) {
|
||||
pv := &v1.PersistentVolume{
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
|
||||
Reference in New Issue
Block a user