Skip to content

Commit 070229f

Browse files
committed
Add flag to all restore commands
1 parent 27fe40f commit 070229f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

nuget_test.go

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

33
import (
44
"encoding/xml"
5-
"github.com/jfrog/jfrog-client-go/utils/log"
65
"os"
76
"path/filepath"
87
"strconv"
@@ -109,18 +108,18 @@ func TestNuGetWithGlobalConfig(t *testing.T) {
109108
err = createConfigFileForTest([]string{jfrogHomeDir}, tests.NugetRemoteRepo, "", t, project.Nuget, true)
110109
assert.NoError(t, err)
111110
// allow insecure connection for testings to work with localhost server
112-
testNugetCmd(t, projectPath, tests.NuGetBuildName, "1", []string{"packagesconfig"}, []string{"nuget", "restore"}, []int{6}, project.Nuget.String())
111+
testNugetCmd(t, projectPath, tests.NuGetBuildName, "1", []string{"packagesconfig"}, []string{"nuget", "restore"}, []int{6})
113112

114113
cleanTestsHomeEnv()
115114
}
116115

117-
func testNugetCmd(t *testing.T, projectPath, buildName, buildNumber string, expectedModule, args []string, expectedDependencies []int, projectType string) {
116+
func testNugetCmd(t *testing.T, projectPath, buildName, buildNumber string, expectedModule, args []string, expectedDependencies []int) {
118117
wd, err := os.Getwd()
119118
assert.NoError(t, err, "Failed to get current dir")
120119
chdirCallback := clientTestUtils.ChangeDirWithCallback(t, wd, projectPath)
121120
defer chdirCallback()
122121

123-
allowInsecureConnectionForTests(projectType, &args)
122+
allowInsecureConnectionForTests(&args)
124123
args = append(args, "--build-name="+buildName, "--build-number="+buildNumber)
125124

126125
err = runNuGet(t, args...)
@@ -158,12 +157,10 @@ func testNugetCmd(t *testing.T, projectPath, buildName, buildNumber string, expe
158157
}
159158

160159
// Add allow insecure connection for testings to work with localhost server
161-
// dotNet also uses this cmd, and we want to apply this only for Nuget.
162-
func allowInsecureConnectionForTests(projectType string, args *[]string) *[]string {
163-
if projectType == project.Nuget.String() {
160+
func allowInsecureConnectionForTests(args *[]string) *[]string {
161+
if slices.Contains(*args, "restore") {
164162
*args = append(*args, "--allow-insecure-connections")
165163
}
166-
log.Debug(projectType)
167164
return args
168165
}
169166

0 commit comments

Comments
 (0)