Skip to content

Commit 5b34971

Browse files
committed
Improve upload archive progress bar
Signed-off-by: Michael Sverdlov <[email protected]>
1 parent 28ab3b3 commit 5b34971

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ require (
188188
sigs.k8s.io/yaml v1.4.0 // indirect
189189
)
190190

191-
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/sverdlov93/jfrog-cli-core/v2 v2.0.2-0.20250127125540-3206abde70dc
191+
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/sverdlov93/jfrog-cli-core/v2 v2.0.2-0.20250127171615-1dd5d75c0c3b
192192

193193
// replace github.com/jfrog/jfrog-cli-security => github.com/EyalDelarea/jfrog-cli-security v0.0.0-20241121103043-02719f295f02
194194

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
363363
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
364364
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
365365
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
366-
github.com/sverdlov93/jfrog-cli-core/v2 v2.0.2-0.20250127125540-3206abde70dc h1:QojsVDrpLKqDKt3Ic5Ejma6Imop7D5GKxB9UjxOMT1s=
367-
github.com/sverdlov93/jfrog-cli-core/v2 v2.0.2-0.20250127125540-3206abde70dc/go.mod h1:o75B8DnTffZIvR303MrAAmOYWqkoIXfXwhYZ2NlHV0c=
366+
github.com/sverdlov93/jfrog-cli-core/v2 v2.0.2-0.20250127171615-1dd5d75c0c3b h1:u+v+zIoOdrVkl/5SJSAHit0yUQtel0aEHi8dD9qWTI8=
367+
github.com/sverdlov93/jfrog-cli-core/v2 v2.0.2-0.20250127171615-1dd5d75c0c3b/go.mod h1:o75B8DnTffZIvR303MrAAmOYWqkoIXfXwhYZ2NlHV0c=
368368
github.com/terminalstatic/go-xsd-validate v0.1.5 h1:RqpJnf6HGE2CB/lZB1A8BYguk8uRtcvYAPLCF15qguo=
369369
github.com/terminalstatic/go-xsd-validate v0.1.5/go.mod h1:18lsvYFofBflqCrvo1umpABZ99+GneNTw2kEEc8UPJw=
370370
github.com/testcontainers/testcontainers-go v0.34.0 h1:5fbgF0vIN5u+nD3IWabQwRybuB4GY8G2HHgCkbMzMHo=

maven_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ func TestSetupMavenCommand(t *testing.T) {
370370
if !*tests.TestMaven {
371371
t.Skip("Skipping Maven test. To run go test add the '-test.maven=true' option.")
372372
}
373+
373374
homeDir, err := os.UserHomeDir()
374375
assert.NoError(t, err)
375376
restoreFunc := prepareMavenSetupTest(t, homeDir)
@@ -391,11 +392,11 @@ func TestSetupMavenCommand(t *testing.T) {
391392
assert.NoError(t, os.RemoveAll(filepath.Join(homeDir, ".m2", "repository", "org", "apache", "commons", "commons-lang3")))
392393

393394
// Run `mvn install` to resolve the artifact from Artifactory and force it to be downloaded.
394-
err = exec.Command("mvn", "dependency:resolve",
395+
output, err := exec.Command("mvn", "dependency:resolve",
395396
"-DgroupId=org.apache.commons",
396397
"-DartifactId=commons-lang3",
397-
"-Dversion=3.8.1").Run()
398-
assert.NoError(t, err)
398+
"-Dversion=3.8.1").Output()
399+
assert.NoError(t, err, fmt.Sprintf("%s\n%q", string(output), err))
399400

400401
// Validate that the artifact exists in the cache after running the test.
401402
// This confirms that the setup command worked and the artifact was resolved from Artifactory.
@@ -406,6 +407,7 @@ func TestSetupMavenCommand(t *testing.T) {
406407
}
407408

408409
func prepareMavenSetupTest(t *testing.T, homeDir string) func() {
410+
initMavenTest(t, false)
409411
settingsXml := filepath.Join(homeDir, ".m2", "settings.xml")
410412

411413
// Back up the existing settings.xml file and ensure restoration after the test.

npm_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ func TestSetupNpmCommand(t *testing.T) {
776776
if !*tests.TestNpm {
777777
t.Skip("Skipping npm test. To run go test add the '-test.npm=true' option.")
778778
}
779+
initNpmTest(t)
779780
// Validate that the module does not exist in the cache before running the test.
780781
client, err := httpclient.ClientBuilder().Build()
781782
assert.NoError(t, err)
@@ -786,9 +787,8 @@ func TestSetupNpmCommand(t *testing.T) {
786787
jfrogCli := coretests.NewJfrogCli(execMain, "jfrog", "")
787788
assert.NoError(t, execGo(jfrogCli, "setup", "npm", "--repo="+tests.NpmRemoteRepo))
788789
// Run 'npm install' to resolve the module from Artifactory and force it to be downloaded from Artifactory.
789-
err = exec.Command("npm", "install", "[email protected]", "--cache", t.TempDir(), "--prefix", t.TempDir()).Run()
790-
assert.NoError(t, err)
791-
790+
output, err := exec.Command("npm", "install", "[email protected]", "--cache", t.TempDir(), "--prefix", t.TempDir()).Output()
791+
assert.NoError(t, err, fmt.Sprintf("%s\n%q", string(output), err))
792792
// Validate that the module exists in the cache after running the test.
793793
// That means that the setup command worked and the 'go get' resolved the module from Artifactory.
794794
_, res, err := client.GetRemoteFileDetails(moduleCacheUrl, artHttpDetails)

nuget_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"encoding/xml"
5+
"fmt"
56
"github.com/jfrog/jfrog-cli-core/v2/utils/ioutils"
67
"github.com/jfrog/jfrog-client-go/http/httpclient"
78
"github.com/jfrog/jfrog-client-go/utils/io"
@@ -214,7 +215,7 @@ type testInitNewConfigDescriptor struct {
214215
func TestInitNewConfig(t *testing.T) {
215216
baseRtUrl := "http://some/url"
216217
expectedV2Url := baseRtUrl + "/api/nuget"
217-
expectedV3Url := baseRtUrl + "/api/nuget/v3"
218+
expectedV3Url := baseRtUrl + "/api/nuget/v3/index.json"
218219
testsSuites := []testInitNewConfigDescriptor{
219220
{"useNugetAddSourceV2", true, expectedV2Url},
220221
{"useNugetAddSourceV3", false, expectedV3Url},
@@ -299,6 +300,7 @@ func testSetupCommand(t *testing.T, packageManager project.ProjectType) {
299300
if !*tests.TestNuget {
300301
t.Skip("Skipping nuget test. To run go test add the '-test.nuget=true' option.")
301302
}
303+
initNugetTest(t)
302304
restoreFunc := prepareSetupTest(t, packageManager)
303305
defer func() {
304306
restoreFunc()
@@ -314,11 +316,13 @@ func testSetupCommand(t *testing.T, packageManager project.ProjectType) {
314316
assert.NoError(t, execGo(jfrogCli, "setup", packageManager.String(), "--repo="+tests.NugetRemoteRepo))
315317

316318
// Run install some random (Nunit) package to test the setup command.
319+
var output []byte
317320
if packageManager == project.Dotnet {
318-
assert.NoError(t, exec.Command(packageManager.String(), "add", "package", "NUnit", "--version", "4.0.1").Run())
321+
output, err = exec.Command(packageManager.String(), "add", "package", "NUnit", "--version", "4.0.1").Output()
319322
} else {
320-
assert.NoError(t, exec.Command(packageManager.String(), "install", "NUnit", "-Version", "4.0.1", "-OutputDirectory", t.TempDir(), "-NoHttpCache").Run())
323+
output, err = exec.Command(packageManager.String(), "install", "NUnit", "-Version", "4.0.1", "-OutputDirectory", t.TempDir(), "-NoHttpCache").Output()
321324
}
325+
assert.NoError(t, err, fmt.Sprintf("%s\n%q", string(output), err))
322326

323327
// Validate that the package exists in the cache after running the test.
324328
// That means that the setup command worked and the package resolved from Artifactory.

0 commit comments

Comments
 (0)