Skip to content

Commit 7820802

Browse files
authored
Merge pull request kubernetes#128952 from my-git9/volume-deadcode
pkg/volume: remove unused function
2 parents 611abd3 + bf12800 commit 7820802

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

pkg/volume/csi/csi_mounter.go

-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
"k8s.io/kubernetes/pkg/volume"
3737
"k8s.io/kubernetes/pkg/volume/util"
3838
volumetypes "k8s.io/kubernetes/pkg/volume/util/types"
39-
"k8s.io/mount-utils"
4039
utilstrings "k8s.io/utils/strings"
4140
)
4241

@@ -571,11 +570,6 @@ func isDirMounted(plug *csiPlugin, dir string) (bool, error) {
571570
return !notMnt, nil
572571
}
573572

574-
func isCorruptedDir(dir string) bool {
575-
_, pathErr := mount.PathExists(dir)
576-
return pathErr != nil && mount.IsCorruptedMnt(pathErr)
577-
}
578-
579573
// removeMountDir cleans the mount dir when dir is not mounted and removed the volume data file in dir
580574
func removeMountDir(plug *csiPlugin, mountPath string) error {
581575
klog.V(4).Info(log("removing mount path [%s]", mountPath))

pkg/volume/csi/csi_mounter_test.go

-31
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"time"
2929

3030
"github.com/google/go-cmp/cmp"
31-
"github.com/stretchr/testify/assert"
3231
authenticationv1 "k8s.io/api/authentication/v1"
3332
corev1 "k8s.io/api/core/v1"
3433
storage "k8s.io/api/storage/v1"
@@ -1155,36 +1154,6 @@ func TestUnmounterTeardownNoClientError(t *testing.T) {
11551154
}
11561155
}
11571156

1158-
func TestIsCorruptedDir(t *testing.T) {
1159-
existingMountPath, err := os.MkdirTemp(os.TempDir(), "blobfuse-csi-mount-test")
1160-
if err != nil {
1161-
t.Fatalf("failed to create tmp dir: %v", err)
1162-
}
1163-
defer os.RemoveAll(existingMountPath)
1164-
1165-
tests := []struct {
1166-
desc string
1167-
dir string
1168-
expectedResult bool
1169-
}{
1170-
{
1171-
desc: "NotExist dir",
1172-
dir: "/tmp/NotExist",
1173-
expectedResult: false,
1174-
},
1175-
{
1176-
desc: "Existing dir",
1177-
dir: existingMountPath,
1178-
expectedResult: false,
1179-
},
1180-
}
1181-
1182-
for i, test := range tests {
1183-
isCorruptedDir := isCorruptedDir(test.dir)
1184-
assert.Equal(t, test.expectedResult, isCorruptedDir, "TestCase[%d]: %s", i, test.desc)
1185-
}
1186-
}
1187-
11881157
func TestPodServiceAccountTokenAttrs(t *testing.T) {
11891158
scheme := runtime.NewScheme()
11901159
utilruntime.Must(pkgauthenticationv1.RegisterDefaults(scheme))

0 commit comments

Comments
 (0)