@@ -372,7 +372,7 @@ func checkNpcapNotices(pkg, file string, contents io.Reader) error {
372372}
373373
374374func checkDocker (t * testing.T , file string , fipsPackage bool ) {
375- p , info , err := readDocker (file )
375+ p , info , err := readDocker (file , true )
376376 if err != nil {
377377 t .Errorf ("error reading file %v: %v" , file , err )
378378 return
@@ -391,6 +391,19 @@ func checkDocker(t *testing.T, file string, fipsPackage bool) {
391391 checkModulesDPresent (t , "" , p )
392392 checkHintsInputsD (t , "hints.inputs.d" , hintsInputsDFilePattern , p )
393393 checkLicensesPresent (t , "licenses/" , p )
394+
395+ if strings .Contains (file , "-complete" ) {
396+ checkCompleteDocker (t , file )
397+ }
398+ }
399+
400+ func checkCompleteDocker (t * testing.T , file string ) {
401+ p , _ , err := readDocker (file , false )
402+ if err != nil {
403+ t .Errorf ("error reading file %v: %v" , file , err )
404+ }
405+
406+ checkSyntheticsDeps (t , "usr" , p )
394407}
395408
396409// Verify that the main configuration file is installed with a 0600 file mode.
@@ -605,6 +618,23 @@ func checkLicensesPresent(t *testing.T, prefix string, p *packageFile) {
605618 }
606619}
607620
621+ func checkSyntheticsDeps (t * testing.T , prefix string , p * packageFile ) {
622+ syntheticsDeps := []string {"node" , "npm" , "elastic-synthetics" , "chrome" }
623+ for _ , dep := range syntheticsDeps {
624+ t .Run ("Binary file " + dep , func (t * testing.T ) {
625+ for _ , entry := range p .Contents {
626+ if strings .HasPrefix (entry .File , prefix ) && strings .HasSuffix (entry .File , "/" + dep ) {
627+ return
628+ }
629+ }
630+ if prefix != "" {
631+ t .Fatalf ("%s not found under %s" , dep , prefix )
632+ }
633+ t .Fatal ("not found" )
634+ })
635+ }
636+ }
637+
608638func checkDockerEntryPoint (t * testing.T , p * packageFile , info * dockerInfo ) {
609639 expectedMode := os .FileMode (0755 )
610640
@@ -942,7 +972,7 @@ func openZip(zipFile string) (*zip.ReadCloser, error) {
942972 return r , nil
943973}
944974
945- func readDocker (dockerFile string ) (* packageFile , * dockerInfo , error ) {
975+ func readDocker (dockerFile string , filterWorkingDir bool ) (* packageFile , * dockerInfo , error ) {
946976 // Read the manifest file first so that the config file and layer
947977 // names are known in advance.
948978 manifest , err := getDockerManifest (dockerFile )
@@ -1009,7 +1039,7 @@ func readDocker(dockerFile string) (*packageFile, *dockerInfo, error) {
10091039 continue
10101040 }
10111041 // Check only files in working dir and entrypoint
1012- if strings .HasPrefix ("/" + name , workingDir ) || "/" + name == entrypoint {
1042+ if ! filterWorkingDir || strings .HasPrefix ("/" + name , workingDir ) || "/" + name == entrypoint {
10131043 p .Contents [name ] = entry
10141044 }
10151045 // Add also licenses
0 commit comments