Skip to content

Commit

Permalink
add go tests
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Oct 30, 2024
1 parent bd8fd1a commit 4e64709
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,25 @@ func testXscAuditMaven(t *testing.T, format string) string {
return securityTests.PlatformCli.RunCliCmdWithOutput(t, "audit", "--mvn", "--licenses", "--format="+format)
}

func TestXrayAuditGoJson(t *testing.T) {
output := testXrayAuditGo(t, string(format.Json), "go-project")
validations.VerifyJsonResults(t, output, validations.ValidationParams{ExactResultsMatch: true})
}

func TestXrayAuditGoSimpleJson(t *testing.T) {
output := testXrayAuditGo(t, string(format.SimpleJson), "missing-context")
validations.VerifySimpleJsonResults(t, output, validations.ValidationParams{ExactResultsMatch: true})
}

func testXrayAuditGo(t *testing.T, format, project string) string {
integration.InitAuditJavaTest(t, scangraph.GraphScanMinXrayVersion)
_, cleanUp := securityTestUtils.CreateTestProjectEnvAndChdir(t, filepath.Join(filepath.FromSlash(securityTests.GetTestResourcesPath()), "projects", "package-managers", "go", project))
defer cleanUp()
// Add dummy descriptor file to check that we run only specific audit
addDummyPackageDescriptor(t, false)
return securityTests.PlatformCli.RunCliCmdWithOutput(t, "audit", "--go", "--licenses", "--format="+format)
}

func TestXrayAuditNoTech(t *testing.T) {
integration.InitAuditGeneralTests(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coreTests.CreateTempDirWithCallbackAndAssert(t)
Expand Down

0 comments on commit 4e64709

Please sign in to comment.