mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Remove ioutil from kube-aggregator
Signed-off-by: inosato <si17_21@yahoo.co.jp>
This commit is contained in:
parent
3902a53419
commit
d2ec8685f5
@ -17,7 +17,7 @@ limitations under the License.
|
|||||||
package apiserver
|
package apiserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
@ -315,7 +315,7 @@ func TestAPIs(t *testing.T) {
|
|||||||
t.Errorf("%s: %v", tc.name, err)
|
t.Errorf("%s: %v", tc.name, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
bytes, err := ioutil.ReadAll(resp.Body)
|
bytes, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("%s: %v", tc.name, err)
|
t.Errorf("%s: %v", tc.name, err)
|
||||||
continue
|
continue
|
||||||
@ -502,7 +502,7 @@ func TestAPIGroup(t *testing.T) {
|
|||||||
t.Errorf("%s: %v", tc.name, string(response))
|
t.Errorf("%s: %v", tc.name, string(response))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
bytes, err := ioutil.ReadAll(resp.Body)
|
bytes, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("%s: %v", tc.name, err)
|
t.Errorf("%s: %v", tc.name, err)
|
||||||
continue
|
continue
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
@ -347,7 +347,7 @@ func TestProxyHandler(t *testing.T) {
|
|||||||
t.Errorf("%s: expected %v, got %v", name, e, a)
|
t.Errorf("%s: expected %v, got %v", name, e, a)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
bytes, err := ioutil.ReadAll(resp.Body)
|
bytes, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("%s: %v", name, err)
|
t.Errorf("%s: %v", name, err)
|
||||||
return
|
return
|
||||||
@ -756,7 +756,7 @@ func TestGetContextForNewRequest(t *testing.T) {
|
|||||||
if resp.StatusCode != http.StatusServiceUnavailable {
|
if resp.StatusCode != http.StatusServiceUnavailable {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -1038,7 +1038,7 @@ func TestFlowControlSignal(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getCertAndKeyPaths(t *testing.T) (string, string, string) {
|
func getCertAndKeyPaths(t *testing.T) (string, string, string) {
|
||||||
dir, err := ioutil.TempDir(os.TempDir(), "k8s-test-handler-proxy-cert")
|
dir, err := os.MkdirTemp(os.TempDir(), "k8s-test-handler-proxy-cert")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unable to create the test directory %q: %v", dir, err)
|
t.Fatalf("Unable to create the test directory %q: %v", dir, err)
|
||||||
}
|
}
|
||||||
@ -1048,10 +1048,10 @@ func getCertAndKeyPaths(t *testing.T) (string, string, string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func writeCerts(certFile, keyFile string, certContent, keyContent []byte, t *testing.T) {
|
func writeCerts(certFile, keyFile string, certContent, keyContent []byte, t *testing.T) {
|
||||||
if err := ioutil.WriteFile(certFile, certContent, 0600); err != nil {
|
if err := os.WriteFile(certFile, certContent, 0600); err != nil {
|
||||||
t.Fatalf("Unable to create the file %q: %v", certFile, err)
|
t.Fatalf("Unable to create the file %q: %v", certFile, err)
|
||||||
}
|
}
|
||||||
if err := ioutil.WriteFile(keyFile, keyContent, 0600); err != nil {
|
if err := os.WriteFile(keyFile, keyContent, 0600); err != nil {
|
||||||
t.Fatalf("Unable to create the file %q: %v", keyFile, err)
|
t.Fatalf("Unable to create the file %q: %v", keyFile, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1078,7 +1078,7 @@ func getSingleCounterValueFromRegistry(t *testing.T, r metrics.Gatherer, name st
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readTestFile(filename string) []byte {
|
func readTestFile(filename string) []byte {
|
||||||
data, err := ioutil.ReadFile("testdata/" + filename)
|
data, err := os.ReadFile("testdata/" + filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user