summaryrefslogtreecommitdiff
path: root/client/image_push_test.go
diff options
context:
space:
mode:
authorEng Zer Jun <engzerjun@gmail.com>2021-08-24 18:10:50 +0800
committerEng Zer Jun <engzerjun@gmail.com>2021-08-27 14:56:57 +0800
commitc55a4ac7795c7606b548b38e24673733481e2167 (patch)
tree8ea03bdc842959cd3d04a3e37a4ce2a71fa77dbb /client/image_push_test.go
parent2b70006e3bfa492b8641ff443493983d832955f4 (diff)
downloaddocker-c55a4ac7795c7606b548b38e24673733481e2167.tar.gz
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Diffstat (limited to 'client/image_push_test.go')
-rw-r--r--client/image_push_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/client/image_push_test.go b/client/image_push_test.go
index a690b8f28e..9b161717ca 100644
--- a/client/image_push_test.go
+++ b/client/image_push_test.go
@@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"strings"
"testing"
@@ -92,7 +92,7 @@ func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {
if auth == "NotValid" {
return &http.Response{
StatusCode: http.StatusUnauthorized,
- Body: ioutil.NopCloser(bytes.NewReader([]byte("Invalid credentials"))),
+ Body: io.NopCloser(bytes.NewReader([]byte("Invalid credentials"))),
}, nil
}
if auth != "IAmValid" {
@@ -105,7 +105,7 @@ func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {
}
return &http.Response{
StatusCode: http.StatusOK,
- Body: ioutil.NopCloser(bytes.NewReader([]byte("hello world"))),
+ Body: io.NopCloser(bytes.NewReader([]byte("hello world"))),
}, nil
}),
}
@@ -119,7 +119,7 @@ func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- body, err := ioutil.ReadAll(resp)
+ body, err := io.ReadAll(resp)
if err != nil {
t.Fatal(err)
}
@@ -178,7 +178,7 @@ func TestImagePushWithoutErrors(t *testing.T) {
}
return &http.Response{
StatusCode: http.StatusOK,
- Body: ioutil.NopCloser(bytes.NewReader([]byte(expectedOutput))),
+ Body: io.NopCloser(bytes.NewReader([]byte(expectedOutput))),
}, nil
}),
}
@@ -188,7 +188,7 @@ func TestImagePushWithoutErrors(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- body, err := ioutil.ReadAll(resp)
+ body, err := io.ReadAll(resp)
if err != nil {
t.Fatal(err)
}