Skip to content

Commit 69e0178

Browse files
authored
Merge pull request kubernetes#87838 from Ikuyadeu/path2filepath
Move 'path' package usage to 'path/filepath' (repeat the kubernetes#87713)
2 parents e4061ba + d1bc187 commit 69e0178

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

pkg/volume/csi/csi_plugin_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"fmt"
2121
"math/rand"
2222
"os"
23-
"path"
2423
"path/filepath"
2524
"testing"
2625

@@ -376,7 +375,7 @@ func TestPluginConstructVolumeSpec(t *testing.T) {
376375
csiMounter := mounter.(*csiMountMgr)
377376

378377
// rebuild spec
379-
spec, err := plug.ConstructVolumeSpec("test-pv", path.Dir(csiMounter.GetPath()))
378+
spec, err := plug.ConstructVolumeSpec("test-pv", filepath.Dir(csiMounter.GetPath()))
380379
if err != nil {
381380
t.Fatal(err)
382381
}
@@ -508,7 +507,7 @@ func TestPluginConstructVolumeSpecWithInline(t *testing.T) {
508507
csiMounter := mounter.(*csiMountMgr)
509508

510509
// rebuild spec
511-
spec, err := plug.ConstructVolumeSpec("test-pv", path.Dir(csiMounter.GetPath()))
510+
spec, err := plug.ConstructVolumeSpec("test-pv", filepath.Dir(csiMounter.GetPath()))
512511
if err != nil {
513512
t.Fatal(err)
514513
}
@@ -636,7 +635,7 @@ func TestPluginNewMounter(t *testing.T) {
636635
}
637636

638637
// ensure data file is created
639-
dataDir := path.Dir(mounter.GetPath())
638+
dataDir := filepath.Dir(mounter.GetPath())
640639
dataFile := filepath.Join(dataDir, volDataFileName)
641640
if _, err := os.Stat(dataFile); err != nil {
642641
if os.IsNotExist(err) {
@@ -775,7 +774,7 @@ func TestPluginNewMounterWithInline(t *testing.T) {
775774
}
776775

777776
// ensure data file is created
778-
dataDir := path.Dir(mounter.GetPath())
777+
dataDir := filepath.Dir(mounter.GetPath())
779778
dataFile := filepath.Join(dataDir, volDataFileName)
780779
if _, err := os.Stat(dataFile); err != nil {
781780
if os.IsNotExist(err) {
@@ -834,7 +833,7 @@ func TestPluginNewUnmounter(t *testing.T) {
834833
}
835834

836835
if err := saveVolumeData(
837-
path.Dir(dir),
836+
filepath.Dir(dir),
838837
volDataFileName,
839838
map[string]string{
840839
volDataKey.specVolID: pv.ObjectMeta.Name,

pkg/volume/csi/csi_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"fmt"
2121
"math/rand"
2222
"os"
23-
"path"
2423
"path/filepath"
2524
"testing"
2625
"time"
@@ -422,14 +421,14 @@ func TestCSI_VolumeAll(t *testing.T) {
422421
}
423422
t.Log("csiTest.VolumeAll mounter.Setup(fsGroup) done OK")
424423

425-
dataFile := filepath.Join(path.Dir(mounter.GetPath()), volDataFileName)
424+
dataFile := filepath.Join(filepath.Dir(mounter.GetPath()), volDataFileName)
426425
if _, err := os.Stat(dataFile); err != nil {
427426
t.Fatalf("csiTest.VolumeAll meatadata JSON file not found: %s", dataFile)
428427
}
429428
t.Log("csiTest.VolumeAll JSON datafile generated OK:", dataFile)
430429

431430
// ******** Volume Reconstruction ************* //
432-
volPath := path.Dir(csiMounter.GetPath())
431+
volPath := filepath.Dir(csiMounter.GetPath())
433432
t.Log("csiTest.VolumeAll entering plugin.ConstructVolumeSpec for path", volPath)
434433
spec, err := volPlug.ConstructVolumeSpec(test.volName, volPath)
435434
if err != nil {

0 commit comments

Comments
 (0)