Skip to content

Commit

Permalink
apply only for nuget tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea committed Nov 14, 2024
1 parent fc07eaa commit 9bc337d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions nuget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func testNativeNugetDotnetResolve(t *testing.T, uniqueTests []testDescriptor, bu
return
}
t.Run(test.name, func(t *testing.T) {
testNugetCmd(t, projectPath, buildName, strconv.Itoa(buildNumber), test.expectedModules, test.args, test.expectedDependencies)
testNugetCmd(t, projectPath, buildName, strconv.Itoa(buildNumber), test.expectedModules, test.args, test.expectedDependencies, projectType.String())
})
}
cleanTestsHomeEnv()
Expand All @@ -107,17 +107,23 @@ func TestNuGetWithGlobalConfig(t *testing.T) {
assert.NoError(t, err)
err = createConfigFileForTest([]string{jfrogHomeDir}, tests.NugetRemoteRepo, "", t, project.Nuget, true)
assert.NoError(t, err)
testNugetCmd(t, projectPath, tests.NuGetBuildName, "1", []string{"packagesconfig"}, []string{"nuget", "restore"}, []int{6})
testNugetCmd(t, projectPath, tests.NuGetBuildName, "1", []string{"packagesconfig"}, []string{"nuget", "restore"}, []int{6}, "")

cleanTestsHomeEnv()
}

func testNugetCmd(t *testing.T, projectPath, buildName, buildNumber string, expectedModule, args []string, expectedDependencies []int) {
func testNugetCmd(t *testing.T, projectPath, buildName, buildNumber string, expectedModule, args []string, expectedDependencies []int, projectType string) {
wd, err := os.Getwd()
assert.NoError(t, err, "Failed to get current dir")
chdirCallback := clientTestUtils.ChangeDirWithCallback(t, wd, projectPath)
defer chdirCallback()
args = append(args, "--build-name="+buildName, "--build-number="+buildNumber, "--allow-insecure-connections")

args = append(args, "--build-name="+buildName, "--build-number="+buildNumber)

// Add allow insecure connection for testings to work with localhost server
if projectType == "nuget" {
args = append(args, "--allow-insecure-connections")
}
err = runNuGet(t, args...)
if err != nil {
return
Expand Down

0 comments on commit 9bc337d

Please sign in to comment.