@@ -312,7 +312,6 @@ func TestRunGetResultsByScanIdSarifFormat(t *testing.T) {
312312}
313313func TestRunGetResultsByScanIdSarifFormatWithContainers (t * testing.T ) {
314314 clearFlags ()
315- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
316315 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "sarif" )
317316 // Remove generated sarif file
318317 removeFileBySuffix (t , printer .FormatSarif )
@@ -334,7 +333,6 @@ func TestRunGetResultsByScanIdSonarFormat(t *testing.T) {
334333
335334func TestRunGetResultsByScanIdSonarFormatWithContainers (t * testing.T ) {
336335 clearFlags ()
337- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
338336 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "sonar" )
339337 // Remove generated sonar file
340338 removeFile (t , fileName + "_" + printer .FormatSonar , printer .FormatJSON )
@@ -367,7 +365,6 @@ func TestDecodeHTMLEntitiesInResults(t *testing.T) {
367365
368366func TestRunGetResultsByScanIdJsonFormatWithContainers (t * testing.T ) {
369367 clearFlags ()
370- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
371368 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "json" )
372369
373370 // Remove generated json file
@@ -390,7 +387,6 @@ func TestRunGetResultsByScanIdSummaryJsonFormat(t *testing.T) {
390387
391388func TestRunGetResultsByScanIdSummaryJsonFormatWithContainers (t * testing.T ) {
392389 clearFlags ()
393- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
394390 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "summaryJSON" )
395391
396392 // Remove generated json file
@@ -406,7 +402,6 @@ func TestRunGetResultsByScanIdSummaryHtmlFormat(t *testing.T) {
406402
407403func TestRunGetResultsByScanIdSummaryHtmlFormatWithContainers (t * testing.T ) {
408404 clearFlags ()
409- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
410405 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "summaryHTML" )
411406
412407 // Remove generated html file
@@ -425,13 +420,11 @@ func TestRunGetResultsByScanIdSummaryMarkdownFormatWithContainers(t *testing.T)
425420
426421func TestRunGetResultsByScanIdSummaryConsoleFormatWithContainers (t * testing.T ) {
427422 clearFlags ()
428- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
429423 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "summaryConsole" )
430424}
431425
432426func TestRunGetResultsByScanIdSummaryMarkdownFormat (t * testing.T ) {
433427 clearFlags ()
434- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
435428 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "markdown" )
436429 // Remove generated md file
437430 removeFileBySuffix (t , "md" )
@@ -480,7 +473,6 @@ func TestRunGetResultsByScanIdPDFFormat(t *testing.T) {
480473
481474func TestRunGetResultsByScanIdPDFFormatWithContainers (t * testing.T ) {
482475 clearFlags ()
483- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
484476 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "pdf" )
485477 _ , err := os .Stat (fmt .Sprintf ("%s.%s" , fileName , printer .FormatPDF ))
486478 assert .NilError (t , err , "Report file should exist for extension " + printer .FormatPDF )
@@ -769,7 +761,6 @@ func TestSBOMReportXML(t *testing.T) {
769761
770762func TestSBOMReportJsonWithContainers (t * testing.T ) {
771763 clearFlags ()
772- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
773764 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "sbom" )
774765 _ , err := os .Stat (fmt .Sprintf ("%s.%s" , fileName + "_" + printer .FormatSbom , printer .FormatJSON ))
775766 assert .NilError (t , err , "Report file should exist for extension " + printer .FormatJSON )
@@ -779,7 +770,6 @@ func TestSBOMReportJsonWithContainers(t *testing.T) {
779770
780771func TestSBOMReportXMLWithContainers (t * testing.T ) {
781772 clearFlags ()
782- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
783773 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "sbom" , "--report-sbom-format" , "CycloneDxXml" )
784774 _ , err := os .Stat (fmt .Sprintf ("%s.%s" , fileName + "_" + printer .FormatSbom , printer .FormatXML ))
785775 assert .NilError (t , err , "Report file should exist for extension " + printer .FormatXML )
@@ -794,24 +784,14 @@ func TestRunGetResultsByScanIdGLFormat(t *testing.T) {
794784}
795785func TestRunResultsShow_ContainersFFIsOn_includeContainersResult (t * testing.T ) {
796786 clearFlags ()
797- clearFlags ()
798- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
799787 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "json" )
800788 assertTypePresentJSON (t , params .ContainersType , 1 )
801789 // Remove generated json file
802790 removeFileBySuffix (t , printer .FormatJSON )
803791}
804- func TestRunResultsShow_ContainersFFIsOff_excludeContainersResult (t * testing.T ) {
805- clearFlags ()
806- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : false }
807- execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "json" )
808- assertTypePresentJSON (t , params .ContainersType , 0 )
809- // Remove generated json file
810- removeFileBySuffix (t , printer .FormatJSON )
811- }
792+
812793func TestRunResultsShow_jetbrainsIsNotSupported_excludeContainersResult (t * testing.T ) {
813794 clearFlags ()
814- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
815795 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "json" , "--agent" , "jetbrains" )
816796 assertTypePresentJSON (t , params .ContainersType , 0 )
817797 // Remove generated json file
@@ -820,7 +800,6 @@ func TestRunResultsShow_jetbrainsIsNotSupported_excludeContainersResult(t *testi
820800
821801func TestRunResultsShow_EclipseIsNotSupported_excludeContainersResult (t * testing.T ) {
822802 clearFlags ()
823- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
824803 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "json" , "--agent" , "Eclipse" )
825804 assertTypePresentJSON (t , params .ContainersType , 0 )
826805 // Remove generated json file
@@ -829,7 +808,6 @@ func TestRunResultsShow_EclipseIsNotSupported_excludeContainersResult(t *testing
829808
830809func TestRunResultsShow_VsCodeIsNotSupported_excludeContainersResult (t * testing.T ) {
831810 clearFlags ()
832- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
833811 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "json" , "--agent" , "vs code" )
834812 assertTypePresentJSON (t , params .ContainersType , 0 )
835813 // Remove generated json file
@@ -838,7 +816,6 @@ func TestRunResultsShow_VsCodeIsNotSupported_excludeContainersResult(t *testing.
838816
839817func TestRunResultsShow_VisualStudioIsNotSupported_excludeContainersResult (t * testing.T ) {
840818 clearFlags ()
841- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : true }
842819 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "json" , "--agent" , "Visual Studio" )
843820 assertTypePresentJSON (t , params .ContainersType , 0 )
844821 // Remove generated json file
@@ -966,11 +943,7 @@ func assertResultsPresentSummaryJSON(t *testing.T, isResultsEnabled bool, scanTy
966943 assert .Assert (t , false , "%s result summary should be present" , scanType )
967944 }
968945}
969- func TestRunGetResultsShow_ContainersFFOffAndResultsHasContainersResultsOnly_NilAssertion (t * testing.T ) {
970- clearFlags ()
971- mock .Flag = wrappers.FeatureFlagResponseModel {Name : wrappers .ContainerEngineCLIEnabled , Status : false }
972- execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "CONTAINERS_ONLY" , "--report-format" , "summaryConsole" )
973- }
946+
974947func TestRunGetResultsByScanIdGLSastAndAScaFormat (t * testing.T ) {
975948 execCmdNilAssertion (t , "results" , "show" , "--scan-id" , "MOCK" , "--report-format" , "gl-sast,gl-sca" )
976949 // Run test for gl-sast report type
@@ -1229,7 +1202,7 @@ func TestGetResultsSummaryConsoleFormatWithCriticalDisabled(t *testing.T) {
12291202 stdoutString := buffer .String ()
12301203 fmt .Print (stdoutString )
12311204
1232- totalSummary := "| TOTAL N/A 5 1 1 0 Completed |"
1205+ totalSummary := "| TOTAL N/A 5 2 1 0 Completed |"
12331206 assert .Equal (t , strings .Contains (stdoutString , totalSummary ), true ,
12341207 "Expected Total summary without critical:" + totalSummary )
12351208
@@ -1248,7 +1221,7 @@ func Test_enhanceWithScanSummary(t *testing.T) {
12481221 name : "scan summary with no vulnerabilities" ,
12491222 summary : createEmptyResultSummary (),
12501223 results : & wrappers.ScanResultsCollection {
1251- Results : nil ,
1224+ Results : [] * wrappers. ScanResult {} ,
12521225 TotalCount : 0 ,
12531226 ScanID : "MOCK" ,
12541227 },
@@ -1266,17 +1239,21 @@ func Test_enhanceWithScanSummary(t *testing.T) {
12661239}
12671240
12681241func createEmptyResultSummary () * wrappers.ResultSummary {
1242+ var containersIssues = new (int )
1243+ * containersIssues = 0
1244+
12691245 return & wrappers.ResultSummary {
1270- TotalIssues : 0 ,
1271- CriticalIssues : 0 ,
1272- HighIssues : 0 ,
1273- MediumIssues : 0 ,
1274- LowIssues : 0 ,
1275- InfoIssues : 0 ,
1276- SastIssues : 0 ,
1277- ScaIssues : 0 ,
1278- KicsIssues : 0 ,
1279- SCSOverview : & wrappers.SCSOverview {},
1246+ TotalIssues : 0 ,
1247+ CriticalIssues : 0 ,
1248+ HighIssues : 0 ,
1249+ MediumIssues : 0 ,
1250+ LowIssues : 0 ,
1251+ InfoIssues : 0 ,
1252+ SastIssues : 0 ,
1253+ ScaIssues : 0 ,
1254+ KicsIssues : 0 ,
1255+ ContainersIssues : containersIssues ,
1256+ SCSOverview : & wrappers.SCSOverview {},
12801257 APISecurity : wrappers.APISecResult {
12811258 APICount : 0 ,
12821259 TotalRisksCount : 0 ,
0 commit comments