Merge pull request #14128 from ahrtr/remove_ioutil

replace ioutil with os package
This commit is contained in:
Benjamin Wang 2022-06-17 15:03:07 +08:00 committed by GitHub
commit 6d1041dc62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View File

@ -15,7 +15,6 @@
package testutil
import (
"io/ioutil"
"log"
"os"
"testing"
@ -44,7 +43,7 @@ func BeforeTest(t testing.TB) {
func BeforeIntegrationExamples(*testing.M) func() {
ExitInShortMode("Skipping: the tests require real cluster")
tempDir, err := ioutil.TempDir(os.TempDir(), "etcd-integration")
tempDir, err := os.MkdirTemp(os.TempDir(), "etcd-integration")
if err != nil {
log.Printf("Failed to obtain tempDir: %v", tempDir)
os.Exit(1)

View File

@ -15,7 +15,7 @@
package testing
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
@ -29,7 +29,7 @@ import (
func NewTmpWAL(t testing.TB, reqs []etcdserverpb.InternalRaftRequest) (*wal.WAL, string) {
t.Helper()
dir, err := ioutil.TempDir(t.TempDir(), "etcd_wal_test")
dir, err := os.MkdirTemp(t.TempDir(), "etcd_wal_test")
if err != nil {
panic(err)
}

View File

@ -15,7 +15,6 @@
package clientv3_test
import (
"io/ioutil"
"log"
"os"
"testing"
@ -47,7 +46,7 @@ func forUnitTestsRunInMockedContext(_ func(), example func()) {
func TestMain(m *testing.M) {
testutil.ExitInShortMode("Skipping: the tests require real cluster")
tempDir, err := ioutil.TempDir(os.TempDir(), "etcd-integration")
tempDir, err := os.MkdirTemp(os.TempDir(), "etcd-integration")
if err != nil {
log.Printf("Failed to obtain tempDir: %v", tempDir)
os.Exit(1)