From e1d0d6b7d6d38b190987c7ea74d4f71401a68ee0 Mon Sep 17 00:00:00 2001 From: eyalbe4 Date: Sun, 3 Nov 2024 11:19:58 +0200 Subject: [PATCH] Improve test --- artifactory_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/artifactory_test.go b/artifactory_test.go index 705e1d834..1f2466625 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -3679,9 +3679,20 @@ func TestArtifactoryCopyByBuildPatternAllUsingSpec(t *testing.T) { cleanArtifactoryTest() } +// ////// func TestArtifactorySortAndLimit(t *testing.T) { initArtifactoryTest(t, "") + // We're changing the temp directory, to ensure it is unique for this test, + // and doesn't include temp files from other tests. + // This is for the "testTempDirCleanFromTempFiles" performed towards the end + // of this function. + originalTempDirBase := fileutils.GetTempDirBase() + defer func() { + fileutils.SetTempDirBase(originalTempDirBase) + }() + fileutils.SetTempDirBase("TestArtifactorySortAndLimit") + // Upload all testdata/a/ files runRt(t, "upload", "testdata/a/(*)", tests.RtRepo1+"/data/{1}") @@ -3713,7 +3724,7 @@ func testTempDirCleanFromTempFiles(t *testing.T) { for _, file := range files { if !file.IsDir() { - assert.False(t, strings.HasPrefix(file.Name(), prefix), + require.False(t, strings.HasPrefix(file.Name(), prefix), "Found a file with a name starting with the prefix '%s': %s", prefix, file.Name()) } }