Skip to content

Commit

Permalink
Show response to console also in case of partial scan (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
checkmarx-kobi-hagmi authored May 30, 2024
1 parent 9c85d69 commit 0af9e86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions internal/commands/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ func getScannerResponse(scanTypesFlagValue string, scanResponseModel *wrappers.S
if scanResponseModel.Status == wrappers.ScanCanceled ||
scanResponseModel.Status == wrappers.ScanRunning ||
scanResponseModel.Status == wrappers.ScanQueued ||
scanResponseModel.Status == wrappers.ScanPartial ||
scanResponseModel.Status == wrappers.ScanCompleted {
result := ScannerResponse{
ScanID: scanResponseModel.ID,
Expand Down
6 changes: 3 additions & 3 deletions internal/commands/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ func TestResultsExitCode_OnPartialScan_PrintOnlyFailedScannersInfoToConsole(t *t
Status: wrappers.ScanPartial,
StatusDetails: []wrappers.StatusInfo{
{Status: wrappers.ScanCompleted, Name: "sast"},
{Status: wrappers.ScanFailed, Name: "sca", Details: "error message from sca scanner", ErrorCode: 4343},
{Status: wrappers.ScanCanceled, Name: "sca", Details: "error message from sca scanner", ErrorCode: 4343},
{Status: wrappers.ScanCompleted, Name: "general"},
},
}

results := getScannerResponse("", &model)

assert.Equal(t, len(results), 1, "Scanner results should be empty")
assert.Equal(t, results[0].Name, "sca", "")
assert.Equal(t, results[0].ErrorCode, "4343", "")
assert.Equal(t, results[0].ScanID, "fake-scan-id-sca-fail-partial-id", "")
assert.Equal(t, results[0].Status, "Partial", "")
}

func TestResultsExitCode_OnCanceledScan_PrintOnlyScanIDAndStatusCanceledToConsole(t *testing.T) {
Expand Down

0 comments on commit 0af9e86

Please sign in to comment.