Skip to content

Commit f61aab5

Browse files
committed
cli/command/plugin: remove deprecated io/ioutil
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 9bdeb09 commit f61aab5

7 files changed

Lines changed: 19 additions & 21 deletions

File tree

cli/command/plugin/create_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package plugin
33
import (
44
"fmt"
55
"io"
6-
"io/ioutil"
76
"runtime"
87
"testing"
98

@@ -41,7 +40,7 @@ func TestCreateErrors(t *testing.T) {
4140
cli := test.NewFakeCli(&fakeClient{})
4241
cmd := newCreateCommand(cli)
4342
cmd.SetArgs(tc.args)
44-
cmd.SetOut(ioutil.Discard)
43+
cmd.SetOut(io.Discard)
4544
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
4645
}
4746
}
@@ -53,7 +52,7 @@ func TestCreateErrorOnFileAsContextDir(t *testing.T) {
5352
cli := test.NewFakeCli(&fakeClient{})
5453
cmd := newCreateCommand(cli)
5554
cmd.SetArgs([]string{"plugin-foo", tmpFile.Path()})
56-
cmd.SetOut(ioutil.Discard)
55+
cmd.SetOut(io.Discard)
5756
assert.ErrorContains(t, cmd.Execute(), "context must be a directory")
5857
}
5958

@@ -64,7 +63,7 @@ func TestCreateErrorOnContextDirWithoutConfig(t *testing.T) {
6463
cli := test.NewFakeCli(&fakeClient{})
6564
cmd := newCreateCommand(cli)
6665
cmd.SetArgs([]string{"plugin-foo", tmpDir.Path()})
67-
cmd.SetOut(ioutil.Discard)
66+
cmd.SetOut(io.Discard)
6867

6968
expectedErr := "config.json: no such file or directory"
7069
if runtime.GOOS == "windows" {
@@ -82,7 +81,7 @@ func TestCreateErrorOnInvalidConfig(t *testing.T) {
8281
cli := test.NewFakeCli(&fakeClient{})
8382
cmd := newCreateCommand(cli)
8483
cmd.SetArgs([]string{"plugin-foo", tmpDir.Path()})
85-
cmd.SetOut(ioutil.Discard)
84+
cmd.SetOut(io.Discard)
8685
assert.ErrorContains(t, cmd.Execute(), "invalid")
8786
}
8887

@@ -100,7 +99,7 @@ func TestCreateErrorFromDaemon(t *testing.T) {
10099

101100
cmd := newCreateCommand(cli)
102101
cmd.SetArgs([]string{"plugin-foo", tmpDir.Path()})
103-
cmd.SetOut(ioutil.Discard)
102+
cmd.SetOut(io.Discard)
104103
assert.ErrorContains(t, cmd.Execute(), "Error creating plugin")
105104
}
106105

cli/command/plugin/disable_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package plugin
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"testing"
77

88
"github.com/docker/cli/internal/test"
@@ -40,7 +40,7 @@ func TestPluginDisableErrors(t *testing.T) {
4040
pluginDisableFunc: tc.pluginDisableFunc,
4141
}))
4242
cmd.SetArgs(tc.args)
43-
cmd.SetOut(ioutil.Discard)
43+
cmd.SetOut(io.Discard)
4444
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
4545
}
4646
}

cli/command/plugin/enable_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package plugin
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"testing"
77

88
"github.com/docker/cli/internal/test"
@@ -51,7 +51,7 @@ func TestPluginEnableErrors(t *testing.T) {
5151
for key, value := range tc.flags {
5252
cmd.Flags().Set(key, value)
5353
}
54-
cmd.SetOut(ioutil.Discard)
54+
cmd.SetOut(io.Discard)
5555
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
5656
}
5757
}

cli/command/plugin/inspect_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package plugin
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"testing"
77

88
"github.com/docker/cli/internal/test"
@@ -73,7 +73,7 @@ func TestInspectErrors(t *testing.T) {
7373
for key, value := range tc.flags {
7474
cmd.Flags().Set(key, value)
7575
}
76-
cmd.SetOut(ioutil.Discard)
76+
cmd.SetOut(io.Discard)
7777
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
7878
})
7979
}

cli/command/plugin/install_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package plugin
33
import (
44
"fmt"
55
"io"
6-
"io/ioutil"
76
"strings"
87
"testing"
98

@@ -58,7 +57,7 @@ func TestInstallErrors(t *testing.T) {
5857
cli := test.NewFakeCli(&fakeClient{pluginInstallFunc: tc.installFunc})
5958
cmd := newInstallCommand(cli)
6059
cmd.SetArgs(tc.args)
61-
cmd.SetOut(ioutil.Discard)
60+
cmd.SetOut(io.Discard)
6261
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
6362
}
6463
}
@@ -100,7 +99,7 @@ func TestInstallContentTrustErrors(t *testing.T) {
10099
cli.SetNotaryClient(tc.notaryFunc)
101100
cmd := newInstallCommand(cli)
102101
cmd.SetArgs(tc.args)
103-
cmd.SetOut(ioutil.Discard)
102+
cmd.SetOut(io.Discard)
104103
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
105104
}
106105
}
@@ -117,7 +116,7 @@ func TestInstall(t *testing.T) {
117116
args: []string{"foo"},
118117
expectedOutput: "Installed plugin foo\n",
119118
installFunc: func(name string, options types.PluginInstallOptions) (io.ReadCloser, error) {
120-
return ioutil.NopCloser(strings.NewReader("")), nil
119+
return io.NopCloser(strings.NewReader("")), nil
121120
},
122121
},
123122
{
@@ -126,7 +125,7 @@ func TestInstall(t *testing.T) {
126125
expectedOutput: "Installed plugin foo\n",
127126
installFunc: func(name string, options types.PluginInstallOptions) (io.ReadCloser, error) {
128127
assert.Check(t, options.Disabled)
129-
return ioutil.NopCloser(strings.NewReader("")), nil
128+
return io.NopCloser(strings.NewReader("")), nil
130129
},
131130
},
132131
}

cli/command/plugin/list_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package plugin
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"testing"
77

88
"github.com/docker/cli/internal/test"
@@ -52,7 +52,7 @@ func TestListErrors(t *testing.T) {
5252
for key, value := range tc.flags {
5353
cmd.Flags().Set(key, value)
5454
}
55-
cmd.SetOut(ioutil.Discard)
55+
cmd.SetOut(io.Discard)
5656
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
5757
}
5858
}

cli/command/plugin/remove_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package plugin
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"testing"
77

88
"github.com/docker/cli/internal/test"
@@ -37,7 +37,7 @@ func TestRemoveErrors(t *testing.T) {
3737
})
3838
cmd := newRemoveCommand(cli)
3939
cmd.SetArgs(tc.args)
40-
cmd.SetOut(ioutil.Discard)
40+
cmd.SetOut(io.Discard)
4141
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
4242
}
4343
}

0 commit comments

Comments
 (0)