cli/command/volume: remove deprecated io/ioutil

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit cca73bff41)
Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Sebastiaan van Stijn 2022-02-25 14:34:38 +01:00 committed by Cory Snider
parent 65e4b0e2b3
commit 03d93a93c3
5 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,7 @@
package volume package volume
import ( import (
"io/ioutil" "io"
"reflect" "reflect"
"strings" "strings"
"testing" "testing"
@ -49,7 +49,7 @@ func TestVolumeCreateErrors(t *testing.T) {
for key, value := range tc.flags { for key, value := range tc.flags {
cmd.Flags().Set(key, value) cmd.Flags().Set(key, value)
} }
cmd.SetOut(ioutil.Discard) cmd.SetOut(io.Discard)
assert.ErrorContains(t, cmd.Execute(), tc.expectedError) assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
} }
} }

View File

@ -2,7 +2,7 @@ package volume
import ( import (
"fmt" "fmt"
"io/ioutil" "io"
"testing" "testing"
"github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test"
@ -60,7 +60,7 @@ func TestVolumeInspectErrors(t *testing.T) {
for key, value := range tc.flags { for key, value := range tc.flags {
cmd.Flags().Set(key, value) cmd.Flags().Set(key, value)
} }
cmd.SetOut(ioutil.Discard) cmd.SetOut(io.Discard)
assert.ErrorContains(t, cmd.Execute(), tc.expectedError) assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
} }
} }

View File

@ -1,7 +1,7 @@
package volume package volume
import ( import (
"io/ioutil" "io"
"testing" "testing"
"github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/config/configfile"
@ -43,7 +43,7 @@ func TestVolumeListErrors(t *testing.T) {
for key, value := range tc.flags { for key, value := range tc.flags {
cmd.Flags().Set(key, value) cmd.Flags().Set(key, value)
} }
cmd.SetOut(ioutil.Discard) cmd.SetOut(io.Discard)
assert.ErrorContains(t, cmd.Execute(), tc.expectedError) assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
} }
} }

View File

@ -2,7 +2,7 @@ package volume
import ( import (
"fmt" "fmt"
"io/ioutil" "io"
"runtime" "runtime"
"strings" "strings"
"testing" "testing"
@ -48,7 +48,7 @@ func TestVolumePruneErrors(t *testing.T) {
for key, value := range tc.flags { for key, value := range tc.flags {
cmd.Flags().Set(key, value) cmd.Flags().Set(key, value)
} }
cmd.SetOut(ioutil.Discard) cmd.SetOut(io.Discard)
assert.ErrorContains(t, cmd.Execute(), tc.expectedError) assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
} }
} }
@ -86,7 +86,7 @@ func TestVolumePrunePromptYes(t *testing.T) {
volumePruneFunc: simplePruneFunc, volumePruneFunc: simplePruneFunc,
}) })
cli.SetIn(streams.NewIn(ioutil.NopCloser(strings.NewReader(input)))) cli.SetIn(streams.NewIn(io.NopCloser(strings.NewReader(input))))
cmd := NewPruneCommand(cli) cmd := NewPruneCommand(cli)
assert.NilError(t, cmd.Execute()) assert.NilError(t, cmd.Execute())
golden.Assert(t, cli.OutBuffer().String(), "volume-prune-yes.golden") golden.Assert(t, cli.OutBuffer().String(), "volume-prune-yes.golden")
@ -102,7 +102,7 @@ func TestVolumePrunePromptNo(t *testing.T) {
volumePruneFunc: simplePruneFunc, volumePruneFunc: simplePruneFunc,
}) })
cli.SetIn(streams.NewIn(ioutil.NopCloser(strings.NewReader(input)))) cli.SetIn(streams.NewIn(io.NopCloser(strings.NewReader(input))))
cmd := NewPruneCommand(cli) cmd := NewPruneCommand(cli)
assert.NilError(t, cmd.Execute()) assert.NilError(t, cmd.Execute())
golden.Assert(t, cli.OutBuffer().String(), "volume-prune-no.golden") golden.Assert(t, cli.OutBuffer().String(), "volume-prune-no.golden")

View File

@ -1,7 +1,7 @@
package volume package volume
import ( import (
"io/ioutil" "io"
"testing" "testing"
"github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test"
@ -32,7 +32,7 @@ func TestVolumeRemoveErrors(t *testing.T) {
volumeRemoveFunc: tc.volumeRemoveFunc, volumeRemoveFunc: tc.volumeRemoveFunc,
})) }))
cmd.SetArgs(tc.args) cmd.SetArgs(tc.args)
cmd.SetOut(ioutil.Discard) cmd.SetOut(io.Discard)
assert.ErrorContains(t, cmd.Execute(), tc.expectedError) assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
} }
} }