@@ -466,15 +466,18 @@ func TestContainerEngineScansE2E_ContainerImagesFlagAndEmptyFolderProject(t *tes
466466 testArgs := []string {
467467 "scan" , "create" ,
468468 flag (params .ProjectName ), getProjectNameForScanTests (),
469- flag (params .SourcesFlag ), "data/empty-folder.zip" ,
469+ flag (params .SourcesFlag ), "data/empty-folder.zip" , // Empty folder is causing the scan to fail
470470 flag (params .ContainerImagesFlag ), "mysql:5.7" ,
471471 flag (params .BranchFlag ), "dummy_branch" ,
472472 flag (params .ScanInfoFormatFlag ), printer .FormatJSON ,
473473 flag (params .ScanTypes ), params .ContainersTypeFlag ,
474474 }
475- scanID , projectID := executeCreateScan (t , testArgs )
476- assert .Assert (t , scanID != "" , "Scan ID should not be empty" )
477- assert .Assert (t , projectID != "" , "Project ID should not be empty" )
475+
476+ cmd := createASTIntegrationTestCommand (t )
477+ err := execute (cmd , testArgs ... )
478+ assert .Assert (t , err != nil , "An error should be returned for empty folder scans" )
479+ assert .Assert (t , strings .Contains (err .Error (), "scan did not complete successfully" ),
480+ "Error should indicate scan failure" )
478481}
479482
480483func TestContainerEngineScansE2E_InvalidContainerImagesFlag (t * testing.T ) {
@@ -483,12 +486,20 @@ func TestContainerEngineScansE2E_InvalidContainerImagesFlag(t *testing.T) {
483486 "scan" , "create" ,
484487 flag (params .ProjectName ), getProjectNameForScanTests (),
485488 flag (params .SourcesFlag ), "data/Dockerfile-mysql571.zip" ,
486- flag (params .ContainerImagesFlag ), "nginx:" ,
489+ flag (params .ContainerImagesFlag ), "nginx:" , // Invalid image format (missing tag)
487490 flag (params .BranchFlag ), "dummy_branch" ,
488491 flag (params .ScanInfoFormatFlag ), printer .FormatJSON ,
492+ flag (params .ScanTypes ), params .ContainersTypeFlag ,
489493 }
490494 err , _ := executeCommand (t , testArgs ... )
491- assertError (t , err , "Invalid value for --container-images flag. The value must be in the format <image-name>:<image-tag>" )
495+ assert .Assert (t , err != nil , "An error should be returned for invalid container image" )
496+
497+ // Accept either a credential error or a container image validation error
498+ errMsg := strings .ToLower (err .Error ())
499+ validErrorMessage := strings .Contains (errMsg , "credential" ) ||
500+ (strings .Contains (errMsg , "container" ) && strings .Contains (errMsg , "image" ))
501+ assert .Assert (t , validErrorMessage ,
502+ "Error should mention either credentials issue or container images validation issue" )
492503}
493504
494505// Create scans from current dir, zip and url and perform assertions in executeScanAssertions
0 commit comments