@@ -3,7 +3,6 @@ package remotecontext // import "github.com/docker/docker/builder/remotecontext"
33import (
44 "bytes"
55 "io"
6- "io/ioutil"
76 "net/http"
87 "net/http/httptest"
98 "net/url"
@@ -52,15 +51,15 @@ func TestSelectAcceptableMIME(t *testing.T) {
5251
5352func TestInspectEmptyResponse (t * testing.T ) {
5453 ct := "application/octet-stream"
55- br := ioutil .NopCloser (bytes .NewReader ([]byte ("" )))
54+ br := io .NopCloser (bytes .NewReader ([]byte ("" )))
5655 contentType , bReader , err := inspectResponse (ct , br , 0 )
5756 if err == nil {
5857 t .Fatal ("Should have generated an error for an empty response" )
5958 }
6059 if contentType != "application/octet-stream" {
6160 t .Fatalf ("Content type should be 'application/octet-stream' but is %q" , contentType )
6261 }
63- body , err := ioutil .ReadAll (bReader )
62+ body , err := io .ReadAll (bReader )
6463 if err != nil {
6564 t .Fatal (err )
6665 }
@@ -71,15 +70,15 @@ func TestInspectEmptyResponse(t *testing.T) {
7170
7271func TestInspectResponseBinary (t * testing.T ) {
7372 ct := "application/octet-stream"
74- br := ioutil .NopCloser (bytes .NewReader (binaryContext ))
73+ br := io .NopCloser (bytes .NewReader (binaryContext ))
7574 contentType , bReader , err := inspectResponse (ct , br , int64 (len (binaryContext )))
7675 if err != nil {
7776 t .Fatal (err )
7877 }
7978 if contentType != "application/octet-stream" {
8079 t .Fatalf ("Content type should be 'application/octet-stream' but is %q" , contentType )
8180 }
82- body , err := ioutil .ReadAll (bReader )
81+ body , err := io .ReadAll (bReader )
8382 if err != nil {
8483 t .Fatal (err )
8584 }
@@ -96,7 +95,7 @@ func TestInspectResponseBinary(t *testing.T) {
9695func TestResponseUnsupportedContentType (t * testing.T ) {
9796 content := []byte (dockerfileContents )
9897 ct := "application/json"
99- br := ioutil .NopCloser (bytes .NewReader (content ))
98+ br := io .NopCloser (bytes .NewReader (content ))
10099 contentType , bReader , err := inspectResponse (ct , br , int64 (len (dockerfileContents )))
101100
102101 if err == nil {
@@ -105,7 +104,7 @@ func TestResponseUnsupportedContentType(t *testing.T) {
105104 if contentType != ct {
106105 t .Fatalf ("Should not have altered content-type: orig: %s, altered: %s" , ct , contentType )
107106 }
108- body , err := ioutil .ReadAll (bReader )
107+ body , err := io .ReadAll (bReader )
109108 if err != nil {
110109 t .Fatal (err )
111110 }
@@ -117,15 +116,15 @@ func TestResponseUnsupportedContentType(t *testing.T) {
117116func TestInspectResponseTextSimple (t * testing.T ) {
118117 content := []byte (dockerfileContents )
119118 ct := "text/plain"
120- br := ioutil .NopCloser (bytes .NewReader (content ))
119+ br := io .NopCloser (bytes .NewReader (content ))
121120 contentType , bReader , err := inspectResponse (ct , br , int64 (len (content )))
122121 if err != nil {
123122 t .Fatal (err )
124123 }
125124 if contentType != "text/plain" {
126125 t .Fatalf ("Content type should be 'text/plain' but is %q" , contentType )
127126 }
128- body , err := ioutil .ReadAll (bReader )
127+ body , err := io .ReadAll (bReader )
129128 if err != nil {
130129 t .Fatal (err )
131130 }
@@ -136,15 +135,15 @@ func TestInspectResponseTextSimple(t *testing.T) {
136135
137136func TestInspectResponseEmptyContentType (t * testing.T ) {
138137 content := []byte (dockerfileContents )
139- br := ioutil .NopCloser (bytes .NewReader (content ))
138+ br := io .NopCloser (bytes .NewReader (content ))
140139 contentType , bodyReader , err := inspectResponse ("" , br , int64 (len (content )))
141140 if err != nil {
142141 t .Fatal (err )
143142 }
144143 if contentType != "text/plain" {
145144 t .Fatalf ("Content type should be 'text/plain' but is %q" , contentType )
146145 }
147- body , err := ioutil .ReadAll (bodyReader )
146+ body , err := io .ReadAll (bodyReader )
148147 if err != nil {
149148 t .Fatal (err )
150149 }
@@ -156,15 +155,15 @@ func TestInspectResponseEmptyContentType(t *testing.T) {
156155func TestUnknownContentLength (t * testing.T ) {
157156 content := []byte (dockerfileContents )
158157 ct := "text/plain"
159- br := ioutil .NopCloser (bytes .NewReader (content ))
158+ br := io .NopCloser (bytes .NewReader (content ))
160159 contentType , bReader , err := inspectResponse (ct , br , - 1 )
161160 if err != nil {
162161 t .Fatal (err )
163162 }
164163 if contentType != "text/plain" {
165164 t .Fatalf ("Content type should be 'text/plain' but is %q" , contentType )
166165 }
167- body , err := ioutil .ReadAll (bReader )
166+ body , err := io .ReadAll (bReader )
168167 if err != nil {
169168 t .Fatal (err )
170169 }
@@ -191,7 +190,7 @@ func TestDownloadRemote(t *testing.T) {
191190 assert .NilError (t , err )
192191
193192 assert .Check (t , is .Equal (mimeTypes .TextPlain , contentType ))
194- raw , err := ioutil .ReadAll (content )
193+ raw , err := io .ReadAll (content )
195194 assert .NilError (t , err )
196195 assert .Check (t , is .Equal (dockerfileContents , string (raw )))
197196}
@@ -238,5 +237,5 @@ func TestGetWithStatusError(t *testing.T) {
238237
239238func readBody (b io.ReadCloser ) ([]byte , error ) {
240239 defer b .Close ()
241- return ioutil .ReadAll (b )
240+ return io .ReadAll (b )
242241}
0 commit comments