mirror of https://github.com/docker/cli.git
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:
parent
65e4b0e2b3
commit
03d93a93c3
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue