mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #87838 from Ikuyadeu/path2filepath
Move 'path' package usage to 'path/filepath' (repeat the #87713)
This commit is contained in:
commit
69e01784c1
@ -20,7 +20,6 @@ import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@ -376,7 +375,7 @@ func TestPluginConstructVolumeSpec(t *testing.T) {
|
||||
csiMounter := mounter.(*csiMountMgr)
|
||||
|
||||
// rebuild spec
|
||||
spec, err := plug.ConstructVolumeSpec("test-pv", path.Dir(csiMounter.GetPath()))
|
||||
spec, err := plug.ConstructVolumeSpec("test-pv", filepath.Dir(csiMounter.GetPath()))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -508,7 +507,7 @@ func TestPluginConstructVolumeSpecWithInline(t *testing.T) {
|
||||
csiMounter := mounter.(*csiMountMgr)
|
||||
|
||||
// rebuild spec
|
||||
spec, err := plug.ConstructVolumeSpec("test-pv", path.Dir(csiMounter.GetPath()))
|
||||
spec, err := plug.ConstructVolumeSpec("test-pv", filepath.Dir(csiMounter.GetPath()))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -636,7 +635,7 @@ func TestPluginNewMounter(t *testing.T) {
|
||||
}
|
||||
|
||||
// ensure data file is created
|
||||
dataDir := path.Dir(mounter.GetPath())
|
||||
dataDir := filepath.Dir(mounter.GetPath())
|
||||
dataFile := filepath.Join(dataDir, volDataFileName)
|
||||
if _, err := os.Stat(dataFile); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
@ -775,7 +774,7 @@ func TestPluginNewMounterWithInline(t *testing.T) {
|
||||
}
|
||||
|
||||
// ensure data file is created
|
||||
dataDir := path.Dir(mounter.GetPath())
|
||||
dataDir := filepath.Dir(mounter.GetPath())
|
||||
dataFile := filepath.Join(dataDir, volDataFileName)
|
||||
if _, err := os.Stat(dataFile); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
@ -834,7 +833,7 @@ func TestPluginNewUnmounter(t *testing.T) {
|
||||
}
|
||||
|
||||
if err := saveVolumeData(
|
||||
path.Dir(dir),
|
||||
filepath.Dir(dir),
|
||||
volDataFileName,
|
||||
map[string]string{
|
||||
volDataKey.specVolID: pv.ObjectMeta.Name,
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
@ -422,14 +421,14 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
}
|
||||
t.Log("csiTest.VolumeAll mounter.Setup(fsGroup) done OK")
|
||||
|
||||
dataFile := filepath.Join(path.Dir(mounter.GetPath()), volDataFileName)
|
||||
dataFile := filepath.Join(filepath.Dir(mounter.GetPath()), volDataFileName)
|
||||
if _, err := os.Stat(dataFile); err != nil {
|
||||
t.Fatalf("csiTest.VolumeAll meatadata JSON file not found: %s", dataFile)
|
||||
}
|
||||
t.Log("csiTest.VolumeAll JSON datafile generated OK:", dataFile)
|
||||
|
||||
// ******** Volume Reconstruction ************* //
|
||||
volPath := path.Dir(csiMounter.GetPath())
|
||||
volPath := filepath.Dir(csiMounter.GetPath())
|
||||
t.Log("csiTest.VolumeAll entering plugin.ConstructVolumeSpec for path", volPath)
|
||||
spec, err := volPlug.ConstructVolumeSpec(test.volName, volPath)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user