Merge pull request #106021 from ahrtr/replace_ioutil_with_io_os_pkg_api
Replace ioutil with io and os for pkg/api
This commit is contained in:
commit
cd02a3035f
@ -17,8 +17,8 @@ limitations under the License.
|
||||
package testing
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
@ -59,7 +59,7 @@ func BenchmarkPodConversion(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkNodeConversion(b *testing.B) {
|
||||
data, err := ioutil.ReadFile("node_example.json")
|
||||
data, err := os.ReadFile("node_example.json")
|
||||
if err != nil {
|
||||
b.Fatalf("Unexpected error while reading file: %v", err)
|
||||
}
|
||||
@ -89,7 +89,7 @@ func BenchmarkNodeConversion(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkReplicationControllerConversion(b *testing.B) {
|
||||
data, err := ioutil.ReadFile("replication_controller_example.json")
|
||||
data, err := os.ReadFile("replication_controller_example.json")
|
||||
if err != nil {
|
||||
b.Fatalf("Unexpected error while reading file: %v", err)
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package testing
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -140,7 +140,7 @@ func BenchmarkPodCopy(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkNodeCopy(b *testing.B) {
|
||||
data, err := ioutil.ReadFile("node_example.json")
|
||||
data, err := os.ReadFile("node_example.json")
|
||||
if err != nil {
|
||||
b.Fatalf("Unexpected error while reading file: %v", err)
|
||||
}
|
||||
@ -159,7 +159,7 @@ func BenchmarkNodeCopy(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkReplicationControllerCopy(b *testing.B) {
|
||||
data, err := ioutil.ReadFile("replication_controller_example.json")
|
||||
data, err := os.ReadFile("replication_controller_example.json")
|
||||
if err != nil {
|
||||
b.Fatalf("Unexpected error while reading file: %v", err)
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
gojson "encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"testing"
|
||||
@ -363,7 +363,7 @@ func TestObjectWatchFraming(t *testing.T) {
|
||||
if n, err := w.Write(obj.Bytes()); err != nil || n != len(obj.Bytes()) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sr := streaming.NewDecoder(framer.NewFrameReader(ioutil.NopCloser(out)), s)
|
||||
sr := streaming.NewDecoder(framer.NewFrameReader(io.NopCloser(out)), s)
|
||||
resultSecret := &v1.Secret{}
|
||||
res, _, err := sr.Decode(nil, resultSecret)
|
||||
if err != nil {
|
||||
@ -392,7 +392,7 @@ func TestObjectWatchFraming(t *testing.T) {
|
||||
if n, err := w.Write(obj.Bytes()); err != nil || n != len(obj.Bytes()) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sr = streaming.NewDecoder(framer.NewFrameReader(ioutil.NopCloser(out)), s)
|
||||
sr = streaming.NewDecoder(framer.NewFrameReader(io.NopCloser(out)), s)
|
||||
outEvent := &metav1.WatchEvent{}
|
||||
_, _, err = sr.Decode(nil, outEvent)
|
||||
if err != nil || outEvent.Type != string(watch.Added) {
|
||||
|
Loading…
Reference in New Issue
Block a user