From eaf28d1a7f0270feb5cdb065b6b3cef870b66eae Mon Sep 17 00:00:00 2001 From: Bhanu Reddy Date: Tue, 21 Apr 2026 17:08:57 +0530 Subject: [PATCH 1/6] fix: build+pattern downloads against virtual repos Add replace directive pointing at jfrog-client-go branch fix/build-with-pattern-virtual-repo so CI picks up the virtual-repo pattern-download fix (client-go PR). --- go.mod | 2 ++ go.sum | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 25d60a9fd..e394551fd 100644 --- a/go.mod +++ b/go.mod @@ -258,6 +258,8 @@ require ( //replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.54.2-0.20251007084958-5eeaa42c31a6 +replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.55.1-0.20260421095255-e7c7ca8b4f15 + // replace github.com/jfrog/jfrog-cli-security => github.com/jfrog/jfrog-cli-security dev // replace github.com/jfrog/build-info-go => github.com/reshmifrog/build-info-go v1.8.9-0.20260106113011-c7f131cea484 diff --git a/go.sum b/go.sum index 33c8faa06..2da135d07 100644 --- a/go.sum +++ b/go.sum @@ -428,8 +428,8 @@ github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260421062714-60f8615a2c github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260421062714-60f8615a2c6c/go.mod h1:n18milUWaaWv6o0bWeEDuoweACoZHRTtQPZpyXBPjEs= github.com/jfrog/jfrog-cli-security v1.27.0 h1:0ol8T5xfgK5B2TUUjxeT8SbXqJxytLrHYpVsDs7Qg2Q= github.com/jfrog/jfrog-cli-security v1.27.0/go.mod h1:979Kb3ffhGuPFB6yG+Zr2aWM0J8y49vxlIgsV0A84m0= -github.com/jfrog/jfrog-client-go v1.55.1-0.20260416101832-c47c1246283b h1:45UJJVG/jAA7/q2c/I6wOvKx8wu7EqTD2tEUtktgyug= -github.com/jfrog/jfrog-client-go v1.55.1-0.20260416101832-c47c1246283b/go.mod h1:sCE06+GngPoyrGO0c+vmhgMoVSP83UMNiZnIuNPzU8U= +github.com/jfrog/jfrog-client-go v1.55.1-0.20260421095255-e7c7ca8b4f15 h1:pRDR/T56MBRmwKSlIXqgB0BebzgXgI8YotbQdBZpl5Y= +github.com/jfrog/jfrog-client-go v1.55.1-0.20260421095255-e7c7ca8b4f15/go.mod h1:sCE06+GngPoyrGO0c+vmhgMoVSP83UMNiZnIuNPzU8U= github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 h1:liMMTbpW34dhU4az1GN0pTPADwNmvoRSeoZ6PItiqnY= From 9431e4bc26b06e93aa3b1e8a59c5991c75ccae87 Mon Sep 17 00:00:00 2001 From: Bhanu Reddy Date: Tue, 21 Apr 2026 17:19:12 +0530 Subject: [PATCH 2/6] test: download by build+pattern against virtual repo Guards the jfrog-client-go fix that moves the pattern filter from client-side post-filter (which compared against the backing local repo returned by AQL) to AQL server-side (which resolves virtual repos). --- artifactory_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/artifactory_test.go b/artifactory_test.go index 5095606aa..8c9773989 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -3502,6 +3502,51 @@ func TestArtifactoryDownloadByBuildUsingSimpleDownload(t *testing.T) { cleanArtifactoryTest() } +// TestArtifactoryDownloadByPatternAndBuildFromVirtualRepo guards the fix in jfrog-client-go +// PR #1338: "build+pattern downloads against virtual repos". The client used to post-filter +// build search results by comparing the pattern's repo against each result's Repo field. +// AQL returns the backing local repo name, not the virtual repo the user typed, so any +// download that combined --build with a pattern pointing at a virtual repo returned zero +// files. The fix moves the pattern into the AQL query itself so Artifactory resolves the +// virtual repo server-side. This test fails with "nothing downloaded" against the pre-fix +// client-go. +func TestArtifactoryDownloadByPatternAndBuildFromVirtualRepo(t *testing.T) { + initArtifactoryTest(t, "") + buildNumberA, buildNumberB := "10", "11" + inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) + + // Upload two disjoint sets of files under distinct build numbers, both into the local + // repo that backs RtVirtualRepo, so a virtual-repo pattern must fan out server-side. + specFileA, err := tests.CreateSpec(tests.SplitUploadSpecA) + assert.NoError(t, err) + specFileB, err := tests.CreateSpec(tests.SplitUploadSpecB) + assert.NoError(t, err) + runRt(t, "upload", "--spec="+specFileA, "--build-name="+tests.RtBuildName1, "--build-number="+buildNumberA) + runRt(t, "upload", "--spec="+specFileB, "--build-name="+tests.RtBuildName1, "--build-number="+buildNumberB) + + runRt(t, "build-publish", tests.RtBuildName1, buildNumberA) + runRt(t, "build-publish", tests.RtBuildName1, buildNumberB) + + // Pattern references the *virtual* repo; --build pins to buildNumberA. Only a*.in + // should land under the target. Before the fix this produced an empty directory. + targetDir := filepath.Join(tests.Out, "download", "by_build_virtual") + fileutils.GetFileSeparator() + runRt(t, "download", tests.RtVirtualRepo+"/data/*", targetDir, "--build="+tests.RtBuildName1+"/"+buildNumberA, "--flat=true") + + paths, _ := fileutils.ListFilesRecursiveWalkIntoDirSymlink(tests.Out, false) + expected := []string{ + tests.Out, + filepath.Join(tests.Out, "download"), + filepath.Join(tests.Out, "download", "by_build_virtual"), + filepath.Join(tests.Out, "download", "by_build_virtual", "a1.in"), + filepath.Join(tests.Out, "download", "by_build_virtual", "a2.in"), + filepath.Join(tests.Out, "download", "by_build_virtual", "a3.in"), + } + assert.NoError(t, tests.ValidateListsIdentical(expected, paths)) + + inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) + cleanArtifactoryTest() +} + func TestArtifactoryDownloadByBuildUsingSimpleDownloadWithProject(t *testing.T) { initArtifactoryTest(t, "") accessManager, err := utils.CreateAccessServiceManager(serverDetails, false) From 41518c37b5760fae42da01782299399f911af8f4 Mon Sep 17 00:00:00 2001 From: Bhanu Reddy Date: Tue, 21 Apr 2026 17:27:51 +0530 Subject: [PATCH 3/6] test: cover spec-file and search variants for virtual repo build+pattern Both funnel into SearchBySpecWithBuild and both returned empty results pre-fix when combining --build with a virtual-repo pattern. Guards the spec parser path and the sibling search command alongside the existing CLI-args download test. --- artifactory_test.go | 75 +++++++++++++++++++ .../filespecs/build_pattern_virtual_spec.json | 10 +++ utils/tests/consts.go | 1 + 3 files changed, 86 insertions(+) create mode 100644 testdata/filespecs/build_pattern_virtual_spec.json diff --git a/artifactory_test.go b/artifactory_test.go index 8c9773989..4debacc1b 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -3547,6 +3547,81 @@ func TestArtifactoryDownloadByPatternAndBuildFromVirtualRepo(t *testing.T) { cleanArtifactoryTest() } +// TestArtifactoryDownloadByPatternAndBuildFromVirtualRepoUsingSpec is the spec-file twin of +// TestArtifactoryDownloadByPatternAndBuildFromVirtualRepo. Spec files go through a distinct +// parser (spec.CreateSpecFromFile → CommonParams) before reaching SearchBySpecWithBuild, so +// this asserts the virtual-repo fix survives that path too. +func TestArtifactoryDownloadByPatternAndBuildFromVirtualRepoUsingSpec(t *testing.T) { + initArtifactoryTest(t, "") + buildNumberA, buildNumberB := "10", "11" + inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) + + specFileA, err := tests.CreateSpec(tests.SplitUploadSpecA) + assert.NoError(t, err) + specFileB, err := tests.CreateSpec(tests.SplitUploadSpecB) + assert.NoError(t, err) + runRt(t, "upload", "--spec="+specFileA, "--build-name="+tests.RtBuildName1, "--build-number="+buildNumberA) + runRt(t, "upload", "--spec="+specFileB, "--build-name="+tests.RtBuildName1, "--build-number="+buildNumberB) + runRt(t, "build-publish", tests.RtBuildName1, buildNumberA) + runRt(t, "build-publish", tests.RtBuildName1, buildNumberB) + + downloadSpec, err := tests.CreateSpec(tests.BuildPatternVirtualSpec) + assert.NoError(t, err) + runRt(t, "download", "--spec="+downloadSpec) + + paths, _ := fileutils.ListFilesRecursiveWalkIntoDirSymlink(tests.Out, false) + expected := []string{ + tests.Out, + filepath.Join(tests.Out, "download"), + filepath.Join(tests.Out, "download", "by_build_virtual_spec"), + filepath.Join(tests.Out, "download", "by_build_virtual_spec", "a1.in"), + filepath.Join(tests.Out, "download", "by_build_virtual_spec", "a2.in"), + filepath.Join(tests.Out, "download", "by_build_virtual_spec", "a3.in"), + } + assert.NoError(t, tests.ValidateListsIdentical(expected, paths)) + + inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) + cleanArtifactoryTest() +} + +// TestArtifactorySearchByPatternAndBuildFromVirtualRepo exercises the same fix through the +// `search` command. Download and search both funnel into SearchBySpecWithBuild, so both +// returned empty against pre-fix client-go when combining --build with a virtual-repo pattern. +// Guards against regressing the sibling consumer. +func TestArtifactorySearchByPatternAndBuildFromVirtualRepo(t *testing.T) { + initArtifactoryTest(t, "") + buildNumberA, buildNumberB := "10", "11" + inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) + + specFileA, err := tests.CreateSpec(tests.SplitUploadSpecA) + assert.NoError(t, err) + specFileB, err := tests.CreateSpec(tests.SplitUploadSpecB) + assert.NoError(t, err) + runRt(t, "upload", "--spec="+specFileA, "--build-name="+tests.RtBuildName1, "--build-number="+buildNumberA) + runRt(t, "upload", "--spec="+specFileB, "--build-name="+tests.RtBuildName1, "--build-number="+buildNumberB) + runRt(t, "build-publish", tests.RtBuildName1, buildNumberA) + runRt(t, "build-publish", tests.RtBuildName1, buildNumberB) + + // Reuses the download spec: search ignores the target field and otherwise consumes + // the same pattern + build shape. + searchSpec, err := tests.CreateSpec(tests.BuildPatternVirtualSpec) + assert.NoError(t, err) + results, err := inttestutils.SearchInArtifactory(searchSpec, serverDetails, t) + assert.NoError(t, err) + + // Each result's Path is "/data/"; assert on the trailing + // file names so the test is insensitive to the backing repo AQL chooses to report. + var names []string + for _, r := range results { + names = append(names, filepath.Base(r.Path)) + } + sort.Strings(names) + assert.Equal(t, []string{"a1.in", "a2.in", "a3.in"}, names) + + inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) + cleanArtifactoryTest() +} + func TestArtifactoryDownloadByBuildUsingSimpleDownloadWithProject(t *testing.T) { initArtifactoryTest(t, "") accessManager, err := utils.CreateAccessServiceManager(serverDetails, false) diff --git a/testdata/filespecs/build_pattern_virtual_spec.json b/testdata/filespecs/build_pattern_virtual_spec.json new file mode 100644 index 000000000..2c35535de --- /dev/null +++ b/testdata/filespecs/build_pattern_virtual_spec.json @@ -0,0 +1,10 @@ +{ + "files": [ + { + "pattern": "${VIRTUAL_REPO}/data/*", + "target": "out/download/by_build_virtual_spec/", + "build": "${BUILD_NAME1}/10", + "flat": "true" + } + ] +} diff --git a/utils/tests/consts.go b/utils/tests/consts.go index fd48adea8..f334aa356 100644 --- a/utils/tests/consts.go +++ b/utils/tests/consts.go @@ -26,6 +26,7 @@ const ( BuildDownloadSpecNoBuildNumber = "build_download_spec_no_build_number.json" BuildDownloadSpecNoBuildNumberWithSort = "build_download_spec_no_build_number_with_sort.json" BuildDownloadSpecNoPattern = "build_download_spec_no_pattern.json" + BuildPatternVirtualSpec = "build_pattern_virtual_spec.json" BundleDownloadGpgSpec = "bundle_download_gpg_spec.json" BundleDownloadSpec = "bundle_download_spec.json" BundleDownloadSpecNoPattern = "bundle_download_spec_no_pattern.json" From 3a276adf1ed3232f751ee136476d547631bb317e Mon Sep 17 00:00:00 2001 From: Bhanu Reddy Date: Fri, 24 Apr 2026 12:48:33 +0530 Subject: [PATCH 4/6] updated jfrog client go dependency --- go.mod | 4 +--- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index e394551fd..78816b499 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/jfrog/jfrog-cli-evidence v0.9.2 github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260421062714-60f8615a2c6c github.com/jfrog/jfrog-cli-security v1.27.0 - github.com/jfrog/jfrog-client-go v1.55.1-0.20260416101832-c47c1246283b + github.com/jfrog/jfrog-client-go v1.55.1-0.20260423072450-00abbb525a84 github.com/jszwec/csvutil v1.10.0 github.com/manifoldco/promptui v0.9.0 github.com/spf13/viper v1.21.0 @@ -258,8 +258,6 @@ require ( //replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.54.2-0.20251007084958-5eeaa42c31a6 -replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.55.1-0.20260421095255-e7c7ca8b4f15 - // replace github.com/jfrog/jfrog-cli-security => github.com/jfrog/jfrog-cli-security dev // replace github.com/jfrog/build-info-go => github.com/reshmifrog/build-info-go v1.8.9-0.20260106113011-c7f131cea484 diff --git a/go.sum b/go.sum index 2da135d07..6655ac6aa 100644 --- a/go.sum +++ b/go.sum @@ -428,8 +428,8 @@ github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260421062714-60f8615a2c github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260421062714-60f8615a2c6c/go.mod h1:n18milUWaaWv6o0bWeEDuoweACoZHRTtQPZpyXBPjEs= github.com/jfrog/jfrog-cli-security v1.27.0 h1:0ol8T5xfgK5B2TUUjxeT8SbXqJxytLrHYpVsDs7Qg2Q= github.com/jfrog/jfrog-cli-security v1.27.0/go.mod h1:979Kb3ffhGuPFB6yG+Zr2aWM0J8y49vxlIgsV0A84m0= -github.com/jfrog/jfrog-client-go v1.55.1-0.20260421095255-e7c7ca8b4f15 h1:pRDR/T56MBRmwKSlIXqgB0BebzgXgI8YotbQdBZpl5Y= -github.com/jfrog/jfrog-client-go v1.55.1-0.20260421095255-e7c7ca8b4f15/go.mod h1:sCE06+GngPoyrGO0c+vmhgMoVSP83UMNiZnIuNPzU8U= +github.com/jfrog/jfrog-client-go v1.55.1-0.20260423072450-00abbb525a84 h1:tTRSNXFQc5cxCEln6ASwCnOKCE7XJT43av4MiQFyJ4U= +github.com/jfrog/jfrog-client-go v1.55.1-0.20260423072450-00abbb525a84/go.mod h1:sCE06+GngPoyrGO0c+vmhgMoVSP83UMNiZnIuNPzU8U= github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 h1:liMMTbpW34dhU4az1GN0pTPADwNmvoRSeoZ6PItiqnY= From ab05106f694259556e5d15c4fa524cea4baed854 Mon Sep 17 00:00:00 2001 From: Bhanu Reddy Date: Fri, 24 Apr 2026 13:28:24 +0530 Subject: [PATCH 5/6] test: generate unique build numbers per run for virtual-repo tests Hardcoded build numbers risk colliding with state left by a previously crashed run. Swap to a timestamped uniqueBuildNumberPair helper and generate the spec-file variant inline so the build number propagates cleanly without a fixture. Drops the now-unused fixture/constant. Addresses PR review feedback on #3449. --- artifactory_test.go | 46 +++++++++++++++---- .../filespecs/build_pattern_virtual_spec.json | 10 ---- utils/tests/consts.go | 1 - 3 files changed, 37 insertions(+), 20 deletions(-) delete mode 100644 testdata/filespecs/build_pattern_virtual_spec.json diff --git a/artifactory_test.go b/artifactory_test.go index 4debacc1b..e7b904d24 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -3512,7 +3512,7 @@ func TestArtifactoryDownloadByBuildUsingSimpleDownload(t *testing.T) { // client-go. func TestArtifactoryDownloadByPatternAndBuildFromVirtualRepo(t *testing.T) { initArtifactoryTest(t, "") - buildNumberA, buildNumberB := "10", "11" + buildNumberA, buildNumberB := uniqueBuildNumberPair() inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) // Upload two disjoint sets of files under distinct build numbers, both into the local @@ -3547,13 +3547,41 @@ func TestArtifactoryDownloadByPatternAndBuildFromVirtualRepo(t *testing.T) { cleanArtifactoryTest() } +// uniqueBuildNumberPair returns two distinct build numbers unique across test runs, so +// partially-cleaned state from a previous run never collides with the current one. +func uniqueBuildNumberPair() (string, string) { + base := strconv.FormatInt(time.Now().UnixNano(), 10) + return base + "1", base + "2" +} + +// writeBuildPatternVirtualSpec writes a download spec targeting the virtual repo's data +// directory, pinned to the given build number. Generated inline so the spec always +// reflects the runtime-unique build number used during upload. +func writeBuildPatternVirtualSpec(t *testing.T, buildNumber string) string { + assert.NoError(t, fileutils.CreateDirIfNotExist(tests.Out)) + specContent := fmt.Sprintf(`{ + "files": [ + { + "pattern": "%s/data/*", + "target": "out/download/by_build_virtual_spec/", + "build": "%s/%s", + "flat": "true" + } + ] +}`, tests.RtVirtualRepo, tests.RtBuildName1, buildNumber) + + specFile := filepath.Join(tests.Out, "build_pattern_virtual_spec.json") + assert.NoError(t, os.WriteFile(specFile, []byte(specContent), 0644)) + return specFile +} + // TestArtifactoryDownloadByPatternAndBuildFromVirtualRepoUsingSpec is the spec-file twin of // TestArtifactoryDownloadByPatternAndBuildFromVirtualRepo. Spec files go through a distinct // parser (spec.CreateSpecFromFile → CommonParams) before reaching SearchBySpecWithBuild, so // this asserts the virtual-repo fix survives that path too. func TestArtifactoryDownloadByPatternAndBuildFromVirtualRepoUsingSpec(t *testing.T) { initArtifactoryTest(t, "") - buildNumberA, buildNumberB := "10", "11" + buildNumberA, buildNumberB := uniqueBuildNumberPair() inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) specFileA, err := tests.CreateSpec(tests.SplitUploadSpecA) @@ -3565,8 +3593,9 @@ func TestArtifactoryDownloadByPatternAndBuildFromVirtualRepoUsingSpec(t *testing runRt(t, "build-publish", tests.RtBuildName1, buildNumberA) runRt(t, "build-publish", tests.RtBuildName1, buildNumberB) - downloadSpec, err := tests.CreateSpec(tests.BuildPatternVirtualSpec) - assert.NoError(t, err) + // Spec is built inline so the build number stays unique per run and can't drift + // out of sync with the uploaded builds. + downloadSpec := writeBuildPatternVirtualSpec(t, buildNumberA) runRt(t, "download", "--spec="+downloadSpec) paths, _ := fileutils.ListFilesRecursiveWalkIntoDirSymlink(tests.Out, false) @@ -3590,7 +3619,7 @@ func TestArtifactoryDownloadByPatternAndBuildFromVirtualRepoUsingSpec(t *testing // Guards against regressing the sibling consumer. func TestArtifactorySearchByPatternAndBuildFromVirtualRepo(t *testing.T) { initArtifactoryTest(t, "") - buildNumberA, buildNumberB := "10", "11" + buildNumberA, buildNumberB := uniqueBuildNumberPair() inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildName1, artHttpDetails) specFileA, err := tests.CreateSpec(tests.SplitUploadSpecA) @@ -3602,10 +3631,9 @@ func TestArtifactorySearchByPatternAndBuildFromVirtualRepo(t *testing.T) { runRt(t, "build-publish", tests.RtBuildName1, buildNumberA) runRt(t, "build-publish", tests.RtBuildName1, buildNumberB) - // Reuses the download spec: search ignores the target field and otherwise consumes - // the same pattern + build shape. - searchSpec, err := tests.CreateSpec(tests.BuildPatternVirtualSpec) - assert.NoError(t, err) + // Reuses the same spec shape as the download variant: search ignores the target + // field and otherwise consumes the same pattern + build filter. + searchSpec := writeBuildPatternVirtualSpec(t, buildNumberA) results, err := inttestutils.SearchInArtifactory(searchSpec, serverDetails, t) assert.NoError(t, err) diff --git a/testdata/filespecs/build_pattern_virtual_spec.json b/testdata/filespecs/build_pattern_virtual_spec.json deleted file mode 100644 index 2c35535de..000000000 --- a/testdata/filespecs/build_pattern_virtual_spec.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "files": [ - { - "pattern": "${VIRTUAL_REPO}/data/*", - "target": "out/download/by_build_virtual_spec/", - "build": "${BUILD_NAME1}/10", - "flat": "true" - } - ] -} diff --git a/utils/tests/consts.go b/utils/tests/consts.go index f334aa356..fd48adea8 100644 --- a/utils/tests/consts.go +++ b/utils/tests/consts.go @@ -26,7 +26,6 @@ const ( BuildDownloadSpecNoBuildNumber = "build_download_spec_no_build_number.json" BuildDownloadSpecNoBuildNumberWithSort = "build_download_spec_no_build_number_with_sort.json" BuildDownloadSpecNoPattern = "build_download_spec_no_pattern.json" - BuildPatternVirtualSpec = "build_pattern_virtual_spec.json" BundleDownloadGpgSpec = "bundle_download_gpg_spec.json" BundleDownloadSpec = "bundle_download_spec.json" BundleDownloadSpecNoPattern = "bundle_download_spec_no_pattern.json" From 47ed6ebac23d3faf95479ce6ccdd2715e931f149 Mon Sep 17 00:00:00 2001 From: Bhanu Reddy Date: Fri, 24 Apr 2026 14:10:14 +0530 Subject: [PATCH 6/6] Corrected failing tests by adding actual temp dir --- artifactory_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/artifactory_test.go b/artifactory_test.go index e7b904d24..dcda5151e 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -3556,9 +3556,9 @@ func uniqueBuildNumberPair() (string, string) { // writeBuildPatternVirtualSpec writes a download spec targeting the virtual repo's data // directory, pinned to the given build number. Generated inline so the spec always -// reflects the runtime-unique build number used during upload. +// reflects the runtime-unique build number used during upload. The spec file lives +// under t.TempDir() so it never pollutes tests.Out, which the test compares against. func writeBuildPatternVirtualSpec(t *testing.T, buildNumber string) string { - assert.NoError(t, fileutils.CreateDirIfNotExist(tests.Out)) specContent := fmt.Sprintf(`{ "files": [ { @@ -3570,7 +3570,7 @@ func writeBuildPatternVirtualSpec(t *testing.T, buildNumber string) string { ] }`, tests.RtVirtualRepo, tests.RtBuildName1, buildNumber) - specFile := filepath.Join(tests.Out, "build_pattern_virtual_spec.json") + specFile := filepath.Join(t.TempDir(), "build_pattern_virtual_spec.json") assert.NoError(t, os.WriteFile(specFile, []byte(specContent), 0644)) return specFile }