From 1ecb8edbc2ba8b931c294a7436c9967fc6b8c224 Mon Sep 17 00:00:00 2001 From: Michael Sverdlov Date: Tue, 12 Nov 2024 12:57:06 +0200 Subject: [PATCH] Improve upload archive progress bar Signed-off-by: Michael Sverdlov --- .../packagemanagerlogin_test.go | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/artifactory/commands/packagemanagerlogin/packagemanagerlogin_test.go b/artifactory/commands/packagemanagerlogin/packagemanagerlogin_test.go index 30d62bde5..8bb95abde 100644 --- a/artifactory/commands/packagemanagerlogin/packagemanagerlogin_test.go +++ b/artifactory/commands/packagemanagerlogin/packagemanagerlogin_test.go @@ -341,14 +341,14 @@ func testBuildToolLoginCommandConfigureDotnetNuget(t *testing.T, packageManager nugetConfigDir = ".nuget" } - nugetConfigFilePath := filepath.Join(homeDir, nugetConfigDir, "NuGet", "NuGet.config") + nugetConfigFilePath := filepath.Join(homeDir, nugetConfigDir, "NuGet", "NuGet.Config") - //// Back up the existing NuGet.config and ensure restoration after the test. - //restoreNugetConfigFunc, err := ioutils.BackupFile(nugetConfigFilePath, packageManager.String()+".config.backup") - //assert.NoError(t, err) - //defer func() { - // assert.NoError(t, restoreNugetConfigFunc()) - //}() + // Back up the existing NuGet.config and ensure restoration after the test. + restoreNugetConfigFunc, err := ioutils.BackupFile(nugetConfigFilePath, packageManager.String()+".config.backup") + assert.NoError(t, err) + defer func() { + assert.NoError(t, restoreNugetConfigFunc()) + }() nugetLoginCmd := createTestPackageManagerLoginCommand(packageManager) @@ -361,27 +361,10 @@ func testBuildToolLoginCommandConfigureDotnetNuget(t *testing.T, packageManager // Run the login command and ensure no errors occur. require.NoError(t, nugetLoginCmd.Run()) - found := "" - err = filepath.WalkDir(homeDir, func(path string, d os.DirEntry, err error) error { - if err != nil { - return err - } - - // Check if the file name is "NuGet.Config" - if d.Type().IsRegular() && d.Name() == "NuGet.Config" { - fmt.Printf("Found NuGet.Config at: %s\n", path) - found = path - } - - return nil - }) - assert.NoError(t, err) - assert.NotEmpty(t, found) // Validate that the repository URL was set correctly in Nuget.config. // Read the contents of the temporary Poetry config file. nugetConfigContentBytes, err := os.ReadFile(nugetConfigFilePath) - assert.FileExists(t, nugetConfigFilePath) require.NoError(t, err) nugetConfigContent := string(nugetConfigContentBytes)