@@ -371,17 +371,8 @@ func checkNpcapNotices(pkg, file string, contents io.Reader) error {
371371 return nil
372372}
373373
374- << << << < HEAD
375374func checkDocker (t * testing.T , file string , fipsPackage bool ) {
376- p , info , err := readDocker (file )
377- == == == =
378- func checkDocker (t * testing .T , file string , fipsPackage bool ) (string , int64 ) {
379- if strings .Contains (file , "elastic-otel-collector" ) {
380- return checkEdotCollectorDocker (t , file )
381- }
382-
383375 p , info , err := readDocker (file , true )
384- >> >> >> > f8c1f2ef0 ([Synthetics ] Add e2e test for synthetics deps in complete variants (#8605 ))
385376 if err != nil {
386377 t .Errorf ("error reading file %v: %v" , file , err )
387378 return
@@ -400,66 +391,10 @@ func checkDocker(t *testing.T, file string, fipsPackage bool) (string, int64) {
400391 checkModulesDPresent (t , "" , p )
401392 checkHintsInputsD (t , "hints.inputs.d" , hintsInputsDFilePattern , p )
402393 checkLicensesPresent (t , "licenses/" , p )
403- << << << < HEAD
404- == == == =
405394
406395 if strings .Contains (file , "-complete" ) {
407396 checkCompleteDocker (t , file )
408397 }
409-
410- name , err := dockerName (file , info .Config .Labels )
411- if err != nil {
412- t .Errorf ("error constructing docker name: %v" , err )
413- return "" , - 1
414- }
415-
416- return name , info .Size
417- }
418-
419- func dockerName (file string , labels map [string ]string ) (string , error ) {
420- version , found := labels ["version" ]
421- if ! found {
422- return "" , errors .New ("version label not found" )
423- }
424-
425- parts := strings .Split (file , "/" )
426- if len (parts ) == 0 {
427- return "" , errors .New ("failed to get file name parts" )
428- }
429-
430- lastPart := parts [len (parts )- 1 ]
431- versionIdx := strings .Index (lastPart , version )
432- if versionIdx < 0 {
433- return "" , fmt .Errorf ("version not found in nam %q" , file )
434- }
435- return lastPart [:versionIdx - 1 ], nil
436- }
437-
438- func checkEdotCollectorDocker (t * testing.T , file string ) (string , int64 ) {
439- p , info , err := readDocker (file , true )
440- if err != nil {
441- t .Errorf ("error reading file %v: %v" , file , err )
442- return "" , - 1
443- }
444-
445- checkDockerEntryPoint (t , p , info )
446- checkDockerLabels (t , p , info , file )
447- checkDockerUser (t , p , info , * rootUserContainer )
448- checkFilePermissions (t , p , configFilePattern , os .FileMode (0644 ))
449- checkFilePermissions (t , p , otelcolScriptPattern , os .FileMode (0755 ))
450- checkManifestPermissionsWithMode (t , p , os .FileMode (0644 ))
451- checkModulesPresent (t , "" , p )
452- checkModulesDPresent (t , "" , p )
453- checkLicensesPresent (t , "licenses/" , p )
454-
455- name , err := dockerName (file , info .Config .Labels )
456- if err != nil {
457- t .Errorf ("error constructing docker name: %v" , err )
458- return "" , - 1
459- }
460-
461- return name , info .Size
462- >> >> >> > f8c1f2ef0 ([Synthetics ] Add e2e test for synthetics deps in complete variants (#8605 ))
463398}
464399
465400func checkCompleteDocker (t * testing.T , file string ) {
0 commit comments