@@ -303,7 +303,7 @@ func checkNpcapNotices(pkg, file string, contents io.Reader) error {
303303}
304304
305305func checkDocker (t * testing.T , file string ) {
306- p , info , err := readDocker (file )
306+ p , info , err := readDocker (file , true )
307307 if err != nil {
308308 t .Errorf ("error reading file %v: %v" , file , err )
309309 return
@@ -319,6 +319,19 @@ func checkDocker(t *testing.T, file string) {
319319 checkModulesDPresent (t , "" , p )
320320 checkHintsInputsD (t , "hints.inputs.d" , hintsInputsDFilePattern , p )
321321 checkLicensesPresent (t , "licenses/" , p )
322+
323+ if strings .Contains (file , "-complete" ) {
324+ checkCompleteDocker (t , file )
325+ }
326+ }
327+
328+ func checkCompleteDocker (t * testing.T , file string ) {
329+ p , _ , err := readDocker (file , false )
330+ if err != nil {
331+ t .Errorf ("error reading file %v: %v" , file , err )
332+ }
333+
334+ checkSyntheticsDeps (t , "usr" , p )
322335}
323336
324337// Verify that the main configuration file is installed with a 0600 file mode.
@@ -533,6 +546,23 @@ func checkLicensesPresent(t *testing.T, prefix string, p *packageFile) {
533546 }
534547}
535548
549+ func checkSyntheticsDeps (t * testing.T , prefix string , p * packageFile ) {
550+ syntheticsDeps := []string {"node" , "npm" , "elastic-synthetics" , "chrome" }
551+ for _ , dep := range syntheticsDeps {
552+ t .Run ("Binary file " + dep , func (t * testing.T ) {
553+ for _ , entry := range p .Contents {
554+ if strings .HasPrefix (entry .File , prefix ) && strings .HasSuffix (entry .File , "/" + dep ) {
555+ return
556+ }
557+ }
558+ if prefix != "" {
559+ t .Fatalf ("%s not found under %s" , dep , prefix )
560+ }
561+ t .Fatal ("not found" )
562+ })
563+ }
564+ }
565+
536566func checkDockerEntryPoint (t * testing.T , p * packageFile , info * dockerInfo ) {
537567 expectedMode := os .FileMode (0755 )
538568
@@ -848,7 +878,7 @@ func openZip(zipFile string) (*zip.ReadCloser, error) {
848878 return r , nil
849879}
850880
851- func readDocker (dockerFile string ) (* packageFile , * dockerInfo , error ) {
881+ func readDocker (dockerFile string , filterWorkingDir bool ) (* packageFile , * dockerInfo , error ) {
852882 // Read the manifest file first so that the config file and layer
853883 // names are known in advance.
854884 manifest , err := getDockerManifest (dockerFile )
@@ -915,7 +945,7 @@ func readDocker(dockerFile string) (*packageFile, *dockerInfo, error) {
915945 continue
916946 }
917947 // Check only files in working dir and entrypoint
918- if strings .HasPrefix ("/" + name , workingDir ) || "/" + name == entrypoint {
948+ if ! filterWorkingDir || strings .HasPrefix ("/" + name , workingDir ) || "/" + name == entrypoint {
919949 p .Contents [name ] = entry
920950 }
921951 // Add also licenses
0 commit comments