test: use T.TempDir
to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the test and all its subtests complete. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -150,10 +150,7 @@ func testFailFastWhenConnectShim(abstract bool, dialFn dialFunc) func(*testing.T
|
||||
}
|
||||
|
||||
func newTestListener(t testing.TB, abstract bool) (string, net.Listener, func()) {
|
||||
tmpDir, err := os.MkdirTemp("", "shim-ut-XX")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create tmp directory: %v", err)
|
||||
}
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
// NOTE(fuweid):
|
||||
//
|
||||
|
Reference in New Issue
Block a user