diff options
| author | Eng Zer Jun <engzerjun@gmail.com> | 2021-08-24 18:10:50 +0800 |
|---|---|---|
| committer | Eng Zer Jun <engzerjun@gmail.com> | 2021-08-27 14:56:57 +0800 |
| commit | c55a4ac7795c7606b548b38e24673733481e2167 (patch) | |
| tree | 8ea03bdc842959cd3d04a3e37a4ce2a71fa77dbb /integration/plugin/common | |
| parent | 2b70006e3bfa492b8641ff443493983d832955f4 (diff) | |
| download | docker-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 'integration/plugin/common')
| -rw-r--r-- | integration/plugin/common/plugin_test.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/integration/plugin/common/plugin_test.go b/integration/plugin/common/plugin_test.go index 83e060f82e..72b1b8264d 100644 --- a/integration/plugin/common/plugin_test.go +++ b/integration/plugin/common/plugin_test.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net" "net/http" "os" @@ -81,7 +80,7 @@ func TestPluginInstall(t *testing.T) { assert.NilError(t, err) defer rdr.Close() - _, err = io.Copy(ioutil.Discard, rdr) + _, err = io.Copy(io.Discard, rdr) assert.NilError(t, err) _, _, err = client.PluginInspectWithRaw(ctx, repo) @@ -110,7 +109,7 @@ func TestPluginInstall(t *testing.T) { assert.NilError(t, err) defer rdr.Close() - _, err = io.Copy(ioutil.Discard, rdr) + _, err = io.Copy(io.Discard, rdr) assert.NilError(t, err) _, _, err = client.PluginInspectWithRaw(ctx, repo) @@ -158,7 +157,7 @@ func TestPluginInstall(t *testing.T) { assert.NilError(t, err) defer rdr.Close() - _, err = io.Copy(ioutil.Discard, rdr) + _, err = io.Copy(io.Discard, rdr) assert.NilError(t, err) _, _, err = client.PluginInspectWithRaw(ctx, repo) @@ -172,7 +171,7 @@ func TestPluginsWithRuntimes(t *testing.T) { skip.If(t, testEnv.IsRootless, "Test not supported on rootless due to buggy daemon setup in rootless mode due to daemon restart") skip.If(t, testEnv.OSType == "windows") - dir, err := ioutil.TempDir("", t.Name()) + dir, err := os.MkdirTemp("", t.Name()) assert.NilError(t, err) defer os.RemoveAll(dir) @@ -202,7 +201,7 @@ func TestPluginsWithRuntimes(t *testing.T) { exec runc $@ `, dir) - assert.NilError(t, ioutil.WriteFile(p, []byte(script), 0777)) + assert.NilError(t, os.WriteFile(p, []byte(script), 0777)) type config struct { Runtimes map[string]types.Runtime `json:"runtimes"` @@ -215,7 +214,7 @@ func TestPluginsWithRuntimes(t *testing.T) { }, }) configPath := filepath.Join(dir, "config.json") - ioutil.WriteFile(configPath, cfg, 0644) + os.WriteFile(configPath, cfg, 0644) t.Run("No Args", func(t *testing.T) { d.Restart(t, "--default-runtime=myrt", "--config-file="+configPath) |
