From 0584035f6cfcf56ea58957138b1004b71d77156a Mon Sep 17 00:00:00 2001 From: postmannen Date: Mon, 23 May 2022 18:33:31 +0200 Subject: [PATCH] added flag for persisting tmp with tests --- requests_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/requests_test.go b/requests_test.go index f2997e6..43ec45d 100644 --- a/requests_test.go +++ b/requests_test.go @@ -21,6 +21,7 @@ import ( ) var logging = flag.Bool("logging", false, "set to true to enable the normal logger of the package") +var persistTmp = flag.Bool("persistTmp", false, "set to true to persist the tmp folder") func newServerForTesting(t *testing.T, addressAndPort string, testFolder string) (*server, *Configuration) { if !*logging { @@ -120,8 +121,13 @@ func TestRequest(t *testing.T) { } defer ns.Shutdown() - // tempdir := t.TempDir() - tempDir := "tmp" + var tempDir string + if *persistTmp { + tempDir = "tmp" + } else { + tempDir = t.TempDir() + } + srv, conf := newServerForTesting(t, "127.0.0.1:42222", tempDir) srv.Start() defer srv.Stop()