mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-15 06:43:54 +00:00
io/ioutil deprecated
This commit is contained in:
parent
decf1e1a9b
commit
c47fa95d93
@ -20,7 +20,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -1644,7 +1643,7 @@ func TestAttacherUnmountDevice(t *testing.T) {
|
|||||||
// Make JSON for this object
|
// Make JSON for this object
|
||||||
if tc.jsonFile != "" {
|
if tc.jsonFile != "" {
|
||||||
dataPath := filepath.Join(dir, volDataFileName)
|
dataPath := filepath.Join(dir, volDataFileName)
|
||||||
if err := ioutil.WriteFile(dataPath, []byte(tc.jsonFile), 0644); err != nil {
|
if err := os.WriteFile(dataPath, []byte(tc.jsonFile), 0644); err != nil {
|
||||||
t.Fatalf("error creating %s: %s", dataPath, err)
|
t.Fatalf("error creating %s: %s", dataPath, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ package csi
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -1065,7 +1064,7 @@ func TestUnmounterTeardown(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsCorruptedDir(t *testing.T) {
|
func TestIsCorruptedDir(t *testing.T) {
|
||||||
existingMountPath, err := ioutil.TempDir(os.TempDir(), "blobfuse-csi-mount-test")
|
existingMountPath, err := os.MkdirTemp(os.TempDir(), "blobfuse-csi-mount-test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tmp dir: %v", err)
|
t.Fatalf("failed to create tmp dir: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
@ -143,7 +142,7 @@ func TestSaveVolumeData(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validate content
|
// validate content
|
||||||
data, err := ioutil.ReadFile(file)
|
data, err := os.ReadFile(file)
|
||||||
if !tc.shouldFail && err != nil {
|
if !tc.shouldFail && err != nil {
|
||||||
t.Errorf("failed to read data file: %v", err)
|
t.Errorf("failed to read data file: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user