@@ -284,87 +284,26 @@ func checkNpcapNotices(pkg, file string, contents io.Reader) error {
284284 return nil
285285}
286286
287- << << << < HEAD:dev - tools / packaging / package_test .go
288287func checkDocker (t * testing.T , file string ) {
289- p , info , err := readDocker (file )
290- if err != nil {
291- t .Errorf ("error reading file %v: %v" , file , err )
292- return
293- == == == =
294- func checkDocker (t * testing .T , file string , fipsPackage bool ) (string , int64 ) {
295- if strings .Contains (file , "elastic-otel-collector" ) {
296- return checkEdotCollectorDocker (t , file )
297- }
298-
299288 p , info , err := readDocker (file , true )
300289 if err != nil {
301290 t .Errorf ("error reading file %v: %v" , file , err )
302- return "" , - 1
291+ return
303292 }
304293
305294 checkDockerEntryPoint (t , p , info )
306295 checkDockerLabels (t , p , info , file )
307296 checkDockerUser (t , p , info , * rootUserContainer )
308297 checkFilePermissions (t , p , configFilePattern , os .FileMode (0644 ))
309- if ! fipsPackage {
310- // FIPS docker image do not contain an otelcol script, run this check only on non FIPS-capable images
311- checkFilePermissions (t , p , otelcolScriptPattern , os .FileMode (0755 ))
312- }
298+ checkFilePermissions (t , p , otelcolScriptPattern , os .FileMode (0755 ))
313299 checkManifestPermissionsWithMode (t , p , os .FileMode (0644 ))
314300 checkModulesPresent (t , "" , p )
315301 checkModulesDPresent (t , "" , p )
316- checkHintsInputsD (t , "hints.inputs.d" , hintsInputsDFilePattern , p )
317302 checkLicensesPresent (t , "licenses/" , p )
318303
319304 if strings .Contains (file , "-complete" ) {
320305 checkCompleteDocker (t , file )
321306 }
322-
323- name , err := dockerName (file , info .Config .Labels )
324- if err != nil {
325- t .Errorf ("error constructing docker name: %v" , err )
326- return "" , - 1
327- }
328-
329- return name , info .Size
330- }
331-
332- func dockerName (file string , labels map [string ]string ) (string , error ) {
333- version , found := labels ["version" ]
334- if ! found {
335- return "" , errors .New ("version label not found" )
336- }
337-
338- parts := strings .Split (file , "/" )
339- if len (parts ) == 0 {
340- return "" , errors .New ("failed to get file name parts" )
341- }
342-
343- lastPart := parts [len (parts )- 1 ]
344- versionIdx := strings .Index (lastPart , version )
345- if versionIdx < 0 {
346- return "" , fmt .Errorf ("version not found in nam %q" , file )
347- }
348- return lastPart [:versionIdx - 1 ], nil
349- }
350-
351- func checkEdotCollectorDocker (t * testing.T , file string ) (string , int64 ) {
352- p , info , err := readDocker (file , true )
353- if err != nil {
354- t .Errorf ("error reading file %v: %v" , file , err )
355- return "" , - 1
356- >> >> >> > f8c1f2ef0 ([Synthetics ] Add e2e test for synthetics deps in complete variants (#8605 )):dev - tools / packaging / testing / package_test .go
357- }
358-
359- checkDockerEntryPoint (t , p , info )
360- checkDockerLabels (t , p , info , file )
361- checkDockerUser (t , p , info , * rootUserContainer )
362- checkFilePermissions (t , p , configFilePattern , os .FileMode (0644 ))
363- checkFilePermissions (t , p , otelcolScriptPattern , os .FileMode (0755 ))
364- checkManifestPermissionsWithMode (t , p , os .FileMode (0644 ))
365- checkModulesPresent (t , "" , p )
366- checkModulesDPresent (t , "" , p )
367- checkLicensesPresent (t , "licenses/" , p )
368307}
369308
370309func checkCompleteDocker (t * testing.T , file string ) {
0 commit comments