From 1b31cb98f3f3fd1726f58099c1283b3dfed3bdef Mon Sep 17 00:00:00 2001 From: agrasthn <140591594+agrasth@users.noreply.github.com> Date: Sat, 22 Feb 2025 00:50:48 +0530 Subject: [PATCH] Fix: jfrog rt curl for JFROG_CLI_SERVER_ID environment variable usage --- artifactory_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/artifactory_test.go b/artifactory_test.go index 1737fe05d..c4b52b484 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -5553,6 +5553,18 @@ func TestArtifactoryCurl(t *testing.T) { err = artifactoryCli.WithoutCredentials().Exec("curl", "-XGET", "/api/system/version", "--server-id=not_configured_name_"+tests.ServerId) assert.Error(t, err) + // Set JFROG_CLI_SERVER_ID and check curl command + _ = os.Setenv(coreutils.ServerID, tests.ServerId) + defer func() { + _ = os.Unsetenv(coreutils.ServerID) + }() // Cleanup after test + err = artifactoryCli.WithoutCredentials().Exec("curl", "-XGET", "/api/system/version") + assert.NoError(t, err) + + // Set JFROG_CLI_SERVER_ID with --server-id flag (should use the flag) + err = artifactoryCli.WithoutCredentials().Exec("curl", "-XGET", "/api/system/version", "--server-id="+tests.ServerId) + assert.NoError(t, err) + cleanArtifactoryTest() }