From 42ff1bd3e62408450d7f61fb7df9eaca7aa023de Mon Sep 17 00:00:00 2001 From: Nedyalko Andreev Date: Sat, 5 Mar 2022 15:13:07 +0200 Subject: [PATCH] Fix TestArchiveThresholds to not leave archive in repo --- cmd/archive_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/archive_test.go b/cmd/archive_test.go index 0b53a651866..e281ea9fcff 100644 --- a/cmd/archive_test.go +++ b/cmd/archive_test.go @@ -1,6 +1,7 @@ package cmd import ( + "os" "path/filepath" "testing" @@ -40,10 +41,17 @@ func TestArchiveThresholds(t *testing.T) { t.Run(testCase.name, func(t *testing.T) { t.Parallel() + tmpDir, err := os.MkdirTemp("", "k6archivetest") + require.NoError(t, err) + defer func() { + require.NoError(t, os.RemoveAll(tmpDir)) + }() + tmpPath := filepath.Join(tmpDir, "archive.tar") + cmd := getArchiveCmd(testutils.NewLogger(t), newCommandFlags()) filename, err := filepath.Abs(testCase.testFilename) require.NoError(t, err) - args := []string{filename} + args := []string{filename, "--archive-out", tmpPath} if testCase.noThresholds { args = append(args, "--no-thresholds") }