@@ -285,7 +285,7 @@ func checkNpcapNotices(pkg, file string, contents io.Reader) error {
285285}
286286
287287func checkDocker (t * testing.T , file string ) {
288- p , info , err := readDocker (file )
288+ p , info , err := readDocker (file , true )
289289 if err != nil {
290290 t .Errorf ("error reading file %v: %v" , file , err )
291291 return
@@ -300,6 +300,19 @@ func checkDocker(t *testing.T, file string) {
300300 checkModulesPresent (t , "" , p )
301301 checkModulesDPresent (t , "" , p )
302302 checkLicensesPresent (t , "licenses/" , p )
303+
304+ if strings .Contains (file , "-complete" ) {
305+ checkCompleteDocker (t , file )
306+ }
307+ }
308+
309+ func checkCompleteDocker (t * testing.T , file string ) {
310+ p , _ , err := readDocker (file , false )
311+ if err != nil {
312+ t .Errorf ("error reading file %v: %v" , file , err )
313+ }
314+
315+ checkSyntheticsDeps (t , "usr" , p )
303316}
304317
305318// Verify that the main configuration file is installed with a 0600 file mode.
@@ -499,6 +512,23 @@ func checkLicensesPresent(t *testing.T, prefix string, p *packageFile) {
499512 }
500513}
501514
515+ func checkSyntheticsDeps (t * testing.T , prefix string , p * packageFile ) {
516+ syntheticsDeps := []string {"node" , "npm" , "elastic-synthetics" , "chrome" }
517+ for _ , dep := range syntheticsDeps {
518+ t .Run ("Binary file " + dep , func (t * testing.T ) {
519+ for _ , entry := range p .Contents {
520+ if strings .HasPrefix (entry .File , prefix ) && strings .HasSuffix (entry .File , "/" + dep ) {
521+ return
522+ }
523+ }
524+ if prefix != "" {
525+ t .Fatalf ("%s not found under %s" , dep , prefix )
526+ }
527+ t .Fatal ("not found" )
528+ })
529+ }
530+ }
531+
502532func checkDockerEntryPoint (t * testing.T , p * packageFile , info * dockerInfo ) {
503533 expectedMode := os .FileMode (0755 )
504534
@@ -765,7 +795,7 @@ func openZip(zipFile string) (*zip.ReadCloser, error) {
765795 return r , nil
766796}
767797
768- func readDocker (dockerFile string ) (* packageFile , * dockerInfo , error ) {
798+ func readDocker (dockerFile string , filterWorkingDir bool ) (* packageFile , * dockerInfo , error ) {
769799 // Read the manifest file first so that the config file and layer
770800 // names are known in advance.
771801 manifest , err := getDockerManifest (dockerFile )
@@ -832,7 +862,7 @@ func readDocker(dockerFile string) (*packageFile, *dockerInfo, error) {
832862 continue
833863 }
834864 // Check only files in working dir and entrypoint
835- if strings .HasPrefix ("/" + name , workingDir ) || "/" + name == entrypoint {
865+ if ! filterWorkingDir || strings .HasPrefix ("/" + name , workingDir ) || "/" + name == entrypoint {
836866 p .Contents [name ] = entry
837867 }
838868 // Add also licenses
0 commit comments