From 1549374b12b1fe4cd4818d5b3c2c8289911b2bc5 Mon Sep 17 00:00:00 2001 From: agrasth Date: Wed, 29 Apr 2026 17:46:43 +0530 Subject: [PATCH 1/6] Fix UV and Maven test failures from master regression --- artifactory_test.go | 5 ++++- buildtools/cli.go | 8 ++++++++ utils/tests/proxy/server/server.go | 6 ++++++ uv_test.go | 7 ++++--- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/artifactory_test.go b/artifactory_test.go index a672ea624..dcda5151e 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -1889,7 +1889,10 @@ func checkIfServerIsUp(port, proxyScheme string, useClientCerts bool) error { if err != nil { log.Error(fmt.Sprintf("Couldn't close response body. Error: %s", err.Error())) } - // Any HTTP response (including redirects) confirms the proxy is up and forwarding requests. + if resp.StatusCode != http.StatusOK { + time.Sleep(time.Second) + continue + } return nil } return fmt.Errorf("failed while waiting for the proxy server to be accessible") diff --git a/buildtools/cli.go b/buildtools/cli.go index 184913c30..4b13142d7 100644 --- a/buildtools/cli.go +++ b/buildtools/cli.go @@ -1835,11 +1835,19 @@ func UvCmd(c *cli.Context) error { if err != nil { return err } + // urfave/cli v1 reorders defined flags to the front and parses them before UvCmd + // runs, so they are absent from c.Args(). Fall back to the parsed flag values. + if m := c.String("module"); m != "" { + buildConfiguration.SetModule(m) + } var serverID string filteredArgs, serverID, err = coreutils.ExtractServerIdFromCommand(filteredArgs) if err != nil { return fmt.Errorf("failed to extract server ID: %w", err) } + if serverID == "" { + serverID = c.String("server-id") + } cmdName, uvArgs := getCommandName(filteredArgs) // Peek at --publish-url to populate DeployerRepo for build-info enrichment. // The flag is NOT consumed here — it is forwarded to uv as-is. diff --git a/utils/tests/proxy/server/server.go b/utils/tests/proxy/server/server.go index 2462e5d75..40a3a5fe6 100644 --- a/utils/tests/proxy/server/server.go +++ b/utils/tests/proxy/server/server.go @@ -21,6 +21,12 @@ type httpResponse func(rw http.ResponseWriter, req *http.Request) func handleReverseProxyHttps(reverseProxy *httputil.ReverseProxy) httpResponse { return func(rw http.ResponseWriter, req *http.Request) { + // Health-check path used by checkIfServerIsUp — return 200 directly, + // consistent with httpProxyHandler which also short-circuits on "/". + if req.RequestURI == "/" { + rw.WriteHeader(http.StatusOK) + return + } clilog.Info("*********************************************************") clilog.Info("Scheme: ", "HTTPS") clilog.Info("Host: ", req.Host) diff --git a/uv_test.go b/uv_test.go index 361770df7..52626eb7a 100644 --- a/uv_test.go +++ b/uv_test.go @@ -198,7 +198,8 @@ func TestUvBuild(t *testing.T) { assert.True(t, whl, "expected .whl in dist/") assert.True(t, sdist, "expected .tar.gz in dist/") - // Build info must have 2 artifacts + // Build info records dependencies but no artifacts — artifacts are only + // recorded after jf uv publish (nothing is uploaded to Artifactory by build). inttestutils.ValidateGeneratedBuildInfoModule(t, tests.UvBuildName, buildNumber, "", []string{getUvModuleID(t, projectPath)}, buildinfo.Uv) @@ -207,8 +208,8 @@ func TestUvBuild(t *testing.T) { require.NoError(t, err, "GetBuildInfo failed") require.True(t, found, "build info not found — was jf rt bp successful?") require.Len(t, publishedBuildInfo.BuildInfo.Modules, 1, "expected 1 build info module") - assert.Len(t, publishedBuildInfo.BuildInfo.Modules[0].Artifacts, 2, - "build command should capture .whl and .tar.gz") + assert.Empty(t, publishedBuildInfo.BuildInfo.Modules[0].Artifacts, + "build command should not record artifacts — nothing is uploaded to Artifactory by jf uv build") } // TestUvPublish verifies that `jf uv publish` uploads artifacts to the local From 5139aff3b7d23feb4b88a14978d29835bbfc31d1 Mon Sep 17 00:00:00 2001 From: agrasth Date: Wed, 29 Apr 2026 18:00:01 +0530 Subject: [PATCH 2/6] Fix TestUvSyncNoIndexOnlySha256: unset UV_DEFAULT_INDEX and UV_INDEX_URL to prevent enrichment from leaked env vars --- uv_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/uv_test.go b/uv_test.go index 52626eb7a..0ca0c01a4 100644 --- a/uv_test.go +++ b/uv_test.go @@ -576,6 +576,12 @@ func TestUvSyncNoIndexOnlySha256(t *testing.T) { initUvTest(t) defer cleanUvTest(t) + // Unset global UV index env vars so leaked os.Setenv calls from earlier tests + // or CI environment settings don't trigger Artifactory enrichment on a project + // that has no [[tool.uv.index]] configured. + t.Setenv("UV_DEFAULT_INDEX", "") + t.Setenv("UV_INDEX_URL", "") + // uvproject-no-index has no [[tool.uv.index]] in pyproject.toml projectPath := createUvProject(t, "uv-no-index", "uvproject-no-index") buildNumber := "1" From f56df7280b581d2e6ffc5b2cac304540a5170383 Mon Sep 17 00:00:00 2001 From: agrasth Date: Wed, 29 Apr 2026 18:16:15 +0530 Subject: [PATCH 3/6] Fix UV test failures: clean partial build-info files in teardown, use correct server ID --- uv_test.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/uv_test.go b/uv_test.go index 0ca0c01a4..8276cb093 100644 --- a/uv_test.go +++ b/uv_test.go @@ -45,6 +45,9 @@ func initUvTest(t *testing.T) { func cleanUvTest(_ *testing.T) { inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.UvBuildName, artHttpDetails) + // Remove local partial build-info files from the system temp dir so they + // don't bleed into the next test when jf rt bp merges all partial files. + _ = coreBuild.RemoveBuildDir(tests.UvBuildName, "1", "") tests.CleanFileSystem() } @@ -576,12 +579,6 @@ func TestUvSyncNoIndexOnlySha256(t *testing.T) { initUvTest(t) defer cleanUvTest(t) - // Unset global UV index env vars so leaked os.Setenv calls from earlier tests - // or CI environment settings don't trigger Artifactory enrichment on a project - // that has no [[tool.uv.index]] configured. - t.Setenv("UV_DEFAULT_INDEX", "") - t.Setenv("UV_INDEX_URL", "") - // uvproject-no-index has no [[tool.uv.index]] in pyproject.toml projectPath := createUvProject(t, "uv-no-index", "uvproject-no-index") buildNumber := "1" @@ -1041,7 +1038,7 @@ func TestUvServerIDFlag(t *testing.T) { assert.NoError(t, runUvCmd(t, projectPath, "sync", "--build-name="+tests.UvBuildName, "--build-number="+buildNumber, - "--server-id="+serverDetails.ServerId, + "--server-id=default", // createJfrogHomeConfig registers the test server as "default" )) require.NoError(t, artifactoryCli.Exec("bp", tests.UvBuildName, buildNumber)) From 5cf0159c8a0d5a75feb33c3a6a830275550d7697 Mon Sep 17 00:00:00 2001 From: agrasth Date: Wed, 29 Apr 2026 18:18:16 +0530 Subject: [PATCH 4/6] =?UTF-8?q?Remove=20temporary=20skip=20from=20initUvTe?= =?UTF-8?q?st=20=E2=80=94=20UV=20tests=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uv_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/uv_test.go b/uv_test.go index 8276cb093..14b5a63d6 100644 --- a/uv_test.go +++ b/uv_test.go @@ -34,7 +34,6 @@ func uvIndexEnvName(name string) string { // --------------------------------------------------------------------------- func initUvTest(t *testing.T) { - t.Skip("Skipping UV tests. As they are failing.") if !*tests.TestUv { t.Skip("Skipping UV tests. To run UV tests add the '-test.uv=true' option.") } From e97d82740d4ab6d236f5f7d910fdc84e062d45b8 Mon Sep 17 00:00:00 2001 From: agrasth Date: Wed, 29 Apr 2026 19:07:35 +0530 Subject: [PATCH 5/6] Fix TestUvSyncNoIndexOnlySha256: check local build-info before rt bp to avoid partial file bleed --- uv_test.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/uv_test.go b/uv_test.go index 14b5a63d6..ff3e2720d 100644 --- a/uv_test.go +++ b/uv_test.go @@ -578,6 +578,10 @@ func TestUvSyncNoIndexOnlySha256(t *testing.T) { initUvTest(t) defer cleanUvTest(t) + // Purge any leftover partial build-info files before this test starts so that + // a previous test's enriched sha1 values cannot bleed in when jf rt bp merges. + _ = coreBuild.RemoveBuildDir(tests.UvBuildName, "1", "") + // uvproject-no-index has no [[tool.uv.index]] in pyproject.toml projectPath := createUvProject(t, "uv-no-index", "uvproject-no-index") buildNumber := "1" @@ -585,19 +589,17 @@ func TestUvSyncNoIndexOnlySha256(t *testing.T) { assert.NoError(t, runUvCmd(t, projectPath, "sync", "--build-name="+tests.UvBuildName, "--build-number="+buildNumber)) - require.NoError(t, artifactoryCli.Exec("bp", tests.UvBuildName, buildNumber)) - publishedBuildInfo, found, err := tests.GetBuildInfo(serverDetails, tests.UvBuildName, buildNumber) - require.NoError(t, err, "GetBuildInfo failed") - require.True(t, found, "build info not found — was jf rt bp successful?") - require.NotEmpty(t, publishedBuildInfo.BuildInfo.Modules, + // Check the local build info directly — before publishing to Artifactory — so that + // partial files from previous tests cannot contaminate the result via jf rt bp merging. + localBuilds, err := coreBuild.GetGeneratedBuildsInfo(tests.UvBuildName, buildNumber, "") + require.NoError(t, err, "GetGeneratedBuildsInfo failed") + require.Len(t, localBuilds, 1, "expected exactly one local build-info partial") + require.NotEmpty(t, localBuilds[0].Modules, "uv sync should produce at least one build-info module even without an Artifactory index") - - for _, dep := range publishedBuildInfo.BuildInfo.Modules[0].Dependencies { - // sha256 always comes from uv.lock regardless of Artifactory access + for _, dep := range localBuilds[0].Modules[0].Dependencies { assert.NotEmpty(t, dep.Sha256, "sha256 from uv.lock should always be present for dep %s", dep.Id) - // sha1 should be absent — no [[tool.uv.index]] means no Artifactory enrichment assert.Empty(t, dep.Sha1, "sha1 should be absent when no Artifactory index is configured for dep %s", dep.Id) } From 967c72aed489c0e9156cf7e2ce7d4b5838ee5dbf Mon Sep 17 00:00:00 2001 From: agrasth Date: Wed, 29 Apr 2026 21:19:01 +0530 Subject: [PATCH 6/6] =?UTF-8?q?Remove=20unnecessary=20c.String()=20fallbac?= =?UTF-8?q?ks=20=E2=80=94=20SkipFlagParsing:true=20already=20puts=20all=20?= =?UTF-8?q?args=20in=20c.Args()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildtools/cli.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/buildtools/cli.go b/buildtools/cli.go index 4b13142d7..184913c30 100644 --- a/buildtools/cli.go +++ b/buildtools/cli.go @@ -1835,19 +1835,11 @@ func UvCmd(c *cli.Context) error { if err != nil { return err } - // urfave/cli v1 reorders defined flags to the front and parses them before UvCmd - // runs, so they are absent from c.Args(). Fall back to the parsed flag values. - if m := c.String("module"); m != "" { - buildConfiguration.SetModule(m) - } var serverID string filteredArgs, serverID, err = coreutils.ExtractServerIdFromCommand(filteredArgs) if err != nil { return fmt.Errorf("failed to extract server ID: %w", err) } - if serverID == "" { - serverID = c.String("server-id") - } cmdName, uvArgs := getCommandName(filteredArgs) // Peek at --publish-url to populate DeployerRepo for build-info enrichment. // The flag is NOT consumed here — it is forwarded to uv as-is.