From 9c2df744c12de1b206d68f3dffd660a52c1f8ad5 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Apr 2022 12:40:26 +0200 Subject: [PATCH] Switch to "T.TempDir()" to avoid manual cleanup. --- proxy/proxy_server_test.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/proxy/proxy_server_test.go b/proxy/proxy_server_test.go index b67569f..229546f 100644 --- a/proxy/proxy_server_test.go +++ b/proxy/proxy_server_test.go @@ -27,7 +27,6 @@ import ( "crypto/x509" "encoding/pem" "io/ioutil" - "os" "testing" "time" @@ -43,16 +42,12 @@ const ( ) func newProxyServerForTest(t *testing.T) (*ProxyServer, *rsa.PrivateKey, func()) { - tempdir, err := ioutil.TempDir("", "test") - if err != nil { - t.Fatalf("could not create temporary folder: %s", err) - } + tempdir := t.TempDir() var server *ProxyServer shutdown := func() { if server != nil { server.Stop() } - os.RemoveAll(tempdir) } r := mux.NewRouter()