@@ -164,15 +164,18 @@ func DefaultGoWindowsTestIntegrationArgs() GoTestArgs {
164164
165165// DefaultGoTestIntegrationArgs returns a default set of arguments for running
166166// all integration tests. We tag integration test files with 'integration'.
167- func DefaultGoTestIntegrationArgs () GoTestArgs {
167+ func DefaultGoTestIntegrationArgs (ctx context. Context ) GoTestArgs {
168168 args := makeGoTestArgs ("Integration" )
169169 args .Tags = append (args .Tags , "integration" )
170170
171- synth := exec .Command ("npx" , "@elastic/synthetics" , "-h" )
171+ cmdCtx , cmdCancel := context .WithTimeout (ctx , 5 * time .Second )
172+ defer cmdCancel ()
173+
174+ synth := exec .CommandContext (cmdCtx , "npx" , "@elastic/synthetics" , "-h" )
172175 if synth .Run () == nil {
173176 // Run an empty journey to ensure playwright can be loaded
174177 // catches situations like missing playwright deps
175- cmd := exec .Command ( "sh" , "-c" , "echo 'step(\" t\" , () => { })' | elastic-synthetics --inline" )
178+ cmd := exec .CommandContext ( cmdCtx , "sh" , "-c" , "echo 'step(\" t\" , () => { })' | elastic-synthetics --inline" )
176179 var out strings.Builder
177180 cmd .Stdout = & out
178181 cmd .Stderr = & out
@@ -195,17 +198,17 @@ func DefaultGoTestIntegrationArgs() GoTestArgs {
195198
196199// DefaultGoTestIntegrationFromHostArgs returns a default set of arguments for running
197200// all integration tests from the host system (outside the docker network).
198- func DefaultGoTestIntegrationFromHostArgs () GoTestArgs {
199- args := DefaultGoTestIntegrationArgs ()
201+ func DefaultGoTestIntegrationFromHostArgs (ctx context. Context ) GoTestArgs {
202+ args := DefaultGoTestIntegrationArgs (ctx )
200203 args .Env = WithGoIntegTestHostEnv (args .Env )
201204 return args
202205}
203206
204207// FIPSOnlyGoTestIngrationFromHostArgs returns a default set of arguments for running
205208// all integration tests from the host system (outside the docker network) along
206209// with the GODEBUG=fips140=only arg set.
207- func FIPSOnlyGoTestIntegrationFromHostArgs () GoTestArgs {
208- args := DefaultGoTestIntegrationArgs ()
210+ func FIPSOnlyGoTestIntegrationFromHostArgs (ctx context. Context ) GoTestArgs {
211+ args := DefaultGoTestIntegrationArgs (ctx )
209212 args .Tags = append (args .Tags , "requirefips" )
210213 args .Env = WithGoIntegTestHostEnv (args .Env )
211214 args .Env ["GODEBUG" ] = "fips140=only"
0 commit comments