mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #128952 from my-git9/volume-deadcode
pkg/volume: remove unused function
This commit is contained in:
commit
78208023e2
@ -36,7 +36,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
"k8s.io/kubernetes/pkg/volume/util"
|
"k8s.io/kubernetes/pkg/volume/util"
|
||||||
volumetypes "k8s.io/kubernetes/pkg/volume/util/types"
|
volumetypes "k8s.io/kubernetes/pkg/volume/util/types"
|
||||||
"k8s.io/mount-utils"
|
|
||||||
utilstrings "k8s.io/utils/strings"
|
utilstrings "k8s.io/utils/strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -571,11 +570,6 @@ func isDirMounted(plug *csiPlugin, dir string) (bool, error) {
|
|||||||
return !notMnt, nil
|
return !notMnt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func isCorruptedDir(dir string) bool {
|
|
||||||
_, pathErr := mount.PathExists(dir)
|
|
||||||
return pathErr != nil && mount.IsCorruptedMnt(pathErr)
|
|
||||||
}
|
|
||||||
|
|
||||||
// removeMountDir cleans the mount dir when dir is not mounted and removed the volume data file in dir
|
// removeMountDir cleans the mount dir when dir is not mounted and removed the volume data file in dir
|
||||||
func removeMountDir(plug *csiPlugin, mountPath string) error {
|
func removeMountDir(plug *csiPlugin, mountPath string) error {
|
||||||
klog.V(4).Info(log("removing mount path [%s]", mountPath))
|
klog.V(4).Info(log("removing mount path [%s]", mountPath))
|
||||||
|
@ -28,7 +28,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
authenticationv1 "k8s.io/api/authentication/v1"
|
authenticationv1 "k8s.io/api/authentication/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1"
|
storage "k8s.io/api/storage/v1"
|
||||||
@ -1155,36 +1154,6 @@ func TestUnmounterTeardownNoClientError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsCorruptedDir(t *testing.T) {
|
|
||||||
existingMountPath, err := os.MkdirTemp(os.TempDir(), "blobfuse-csi-mount-test")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("failed to create tmp dir: %v", err)
|
|
||||||
}
|
|
||||||
defer os.RemoveAll(existingMountPath)
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
desc string
|
|
||||||
dir string
|
|
||||||
expectedResult bool
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
desc: "NotExist dir",
|
|
||||||
dir: "/tmp/NotExist",
|
|
||||||
expectedResult: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
desc: "Existing dir",
|
|
||||||
dir: existingMountPath,
|
|
||||||
expectedResult: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, test := range tests {
|
|
||||||
isCorruptedDir := isCorruptedDir(test.dir)
|
|
||||||
assert.Equal(t, test.expectedResult, isCorruptedDir, "TestCase[%d]: %s", i, test.desc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPodServiceAccountTokenAttrs(t *testing.T) {
|
func TestPodServiceAccountTokenAttrs(t *testing.T) {
|
||||||
scheme := runtime.NewScheme()
|
scheme := runtime.NewScheme()
|
||||||
utilruntime.Must(pkgauthenticationv1.RegisterDefaults(scheme))
|
utilruntime.Must(pkgauthenticationv1.RegisterDefaults(scheme))
|
||||||
|
Loading…
Reference in New Issue
Block a user