@@ -466,18 +466,15 @@ func TestContainerEngineScansE2E_ContainerImagesFlagAndEmptyFolderProject(t *tes
466466 testArgs := []string {
467467 "scan" , "create" ,
468468 flag (params .ProjectName ), getProjectNameForScanTests (),
469- flag (params .SourcesFlag ), "data/empty-folder.zip" , // Empty folder is causing the scan to fail
469+ flag (params .SourcesFlag ), "data/empty-folder.zip" ,
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-
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" )
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" )
481478}
482479
483480func TestContainerEngineScansE2E_InvalidContainerImagesFlag (t * testing.T ) {
@@ -486,20 +483,12 @@ func TestContainerEngineScansE2E_InvalidContainerImagesFlag(t *testing.T) {
486483 "scan" , "create" ,
487484 flag (params .ProjectName ), getProjectNameForScanTests (),
488485 flag (params .SourcesFlag ), "data/Dockerfile-mysql571.zip" ,
489- flag (params .ContainerImagesFlag ), "nginx:" , // Invalid image format (missing tag)
486+ flag (params .ContainerImagesFlag ), "nginx:" ,
490487 flag (params .BranchFlag ), "dummy_branch" ,
491488 flag (params .ScanInfoFormatFlag ), printer .FormatJSON ,
492- flag (params .ScanTypes ), params .ContainersTypeFlag ,
493489 }
494490 err , _ := executeCommand (t , testArgs ... )
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" )
491+ assertError (t , err , "Invalid value for --container-images flag. The value must be in the format <image-name>:<image-tag>" )
503492}
504493
505494// Create scans from current dir, zip and url and perform assertions in executeScanAssertions
0 commit comments