Skip to content

Commit

Permalink
added .NET v5.0 testdata and changed name of old testdata single -> s…
Browse files Browse the repository at this point in the history
…ingle4.0
  • Loading branch information
eranturgeman committed Sep 6, 2023
1 parent 2397954 commit 1bb57d0
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 9 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ require (

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230828134416-f0db33dd9344

replace github.com/jfrog/jfrog-cli-core/v2 => ../jfrog-cli-core
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230906140128-d12337ce2598

// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.6-0.20230418122323-2bf299dd6d27

replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230904070427-f3f2a103d9e2

replace github.com/jfrog/build-info-go => ../my-build-info-go
replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230831151231-e5e7bd035ddc
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ github.com/jfrog/build-info-go v1.8.9-0.20230831151231-e5e7bd035ddc h1:pqu82clhP
github.com/jfrog/build-info-go v1.8.9-0.20230831151231-e5e7bd035ddc/go.mod h1:QEskae5fQpjeY2PBzsjWtUQVskYSNDF2sSmw/Gx44dQ=
github.com/jfrog/gofrog v1.3.0 h1:o4zgsBZE4QyDbz2M7D4K6fXPTBJht+8lE87mS9bw7Gk=
github.com/jfrog/gofrog v1.3.0/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904170814-03a7938bae94 h1:rAV/hUZNruzYOfGUqE5ubPY55NMtS59llfTcWGwofSg=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904170814-03a7938bae94/go.mod h1:eQJU+jDTcPVqOeHNheURqkMEMXDVNQFKKjcyVEa0058=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230906140128-d12337ce2598 h1:SD6foGpH6dSbhCm7XrgHbVLET/j4m5+UoB1qn2yqr1U=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230906140128-d12337ce2598/go.mod h1:PCRqGSz6tKQNtiITSk9WZGflJjno/Vg4DvXPLkH6xO8=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230904070427-f3f2a103d9e2 h1:uPDFvUv+3kAUyTR6gAhROAgsjnPe2jsxzqJSkjbIHmE=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230904070427-f3f2a103d9e2/go.mod h1:uUnMrqHX7Xi+OCaZEE4b3BtsmGeOSCB7XqaEWVXEH/E=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions testdata/xray/nuget/single5.0/ClassLibrary1/ClassLibrary1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<Company>Some Compnay</Company>
<Product>Some product</Product>
<Copyright>Copyright © 2020 by Foobar.</Copyright>
<Version>1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.EventLog" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
</ItemGroup>
</Project>
29 changes: 29 additions & 0 deletions testdata/xray/nuget/single5.0/TestSolution.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32106.194
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{757C1D5A-BAA9-453F-B612-A0571390976B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{757C1D5A-BAA9-453F-B612-A0571390976B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{757C1D5A-BAA9-453F-B612-A0571390976B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{757C1D5A-BAA9-453F-B612-A0571390976B}.Release|Any CPU.Build.0 = Release|Any CPU
{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D8547989-C4F7-4FCC-95BB-F7478F7D2484}
EndGlobalSection
EndGlobal
78 changes: 73 additions & 5 deletions xray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,81 @@ func runXrayAuditYarnWithOutput(t *testing.T, format string) string {

// Tests NuGet audit by providing simple NuGet project and asserts any error.
func TestXrayAuditNugetJson(t *testing.T) {
output := testXrayAuditNuget(t, "single", string(utils.Json), true, "nuget")
verifyJsonScanResults(t, output, 0, 2, 0)
var testdata = []struct {
projectName string
format string
runInstallCommand bool
restoreTech string
minVulnerabilities int
}{
{
projectName: "single4.0",
format: string(utils.Json),
runInstallCommand: true,
restoreTech: "nuget",
minVulnerabilities: 2,
},
{
projectName: "single5.0",
format: string(utils.Json),
runInstallCommand: true,
restoreTech: "dotnet",
minVulnerabilities: 3,
},
{
projectName: "single5.0",
format: string(utils.Json),
runInstallCommand: false,
restoreTech: "",
minVulnerabilities: 3,
},
}
for _, test := range testdata {
t.Run(fmt.Sprintf("projectName:%s,runInstallCommand:%t", test.projectName, test.runInstallCommand),
func(t *testing.T) {
output := testXrayAuditNuget(t, test.projectName, test.format, test.runInstallCommand, test.restoreTech)
verifyJsonScanResults(t, output, 0, test.minVulnerabilities, 0)
})
}
}

func TestXrayAuditNugetSimpleJson(t *testing.T) {
output := testXrayAuditNuget(t, "single", string(utils.SimpleJson), true, "nuget")
verifySimpleJsonScanResults(t, output, 2, 0)
var testdata = []struct {
projectName string
format string
runInstallCommand bool
restoreTech string
minVulnerabilities int
}{
{
projectName: "single4.0",
format: string(utils.SimpleJson),
runInstallCommand: true,
restoreTech: "nuget",
minVulnerabilities: 2,
},
{
projectName: "single5.0",
format: string(utils.SimpleJson),
runInstallCommand: true,
restoreTech: "dotnet",
minVulnerabilities: 3,
},
{
projectName: "single5.0",
format: string(utils.SimpleJson),
runInstallCommand: false,
restoreTech: "",
minVulnerabilities: 3,
},
}
for _, test := range testdata {
t.Run(fmt.Sprintf("projectName:%s,runInstallCommand:%t", test.projectName, test.runInstallCommand),
func(t *testing.T) {
output := testXrayAuditNuget(t, test.projectName, test.format, test.runInstallCommand, test.restoreTech)
verifySimpleJsonScanResults(t, output, test.minVulnerabilities, 0)
})
}
}

// Tests NuGet audit by providing a multi-project NuGet project and asserts any error.
Expand Down Expand Up @@ -355,7 +423,7 @@ func TestXrayAuditMultiProjects(t *testing.T) {
// Copy the multi project from the testdata to a temp dir
assert.NoError(t, biutils.CopyDir(multiProject, tempDirPath, true, nil))
workingDirsFlag := fmt.Sprintf("--working-dirs=%s, %s ,%s, %s",
filepath.Join(tempDirPath, "maven"), filepath.Join(tempDirPath, "nuget", "single"),
filepath.Join(tempDirPath, "maven"), filepath.Join(tempDirPath, "nuget", "single4.0"),
filepath.Join(tempDirPath, "python", "pip"), filepath.Join(tempDirPath, "jas-test"))
// Configure a new server named "default"
createJfrogHomeConfig(t, true)
Expand Down

0 comments on commit 1bb57d0

Please sign in to comment.