@@ -143,9 +143,19 @@ func testWorkerDev(t *testing.T, workerConfig *worker.WorkerConfig, profile *pro
143143 return fmt .Errorf ("timeout waiting for pre-commands to complete" )
144144 }
145145
146- // Wait 5 seconds for the worker to fully start, then trigger the workflow
146+ // Wait 5 seconds for the worker to fully start
147147 time .Sleep (5 * time .Second )
148148
149+ // Validate that there are no worker runner errors
150+ select {
151+ case err := <- errChan :
152+ if err != nil {
153+ return fmt .Errorf ("worker exited during startup: %w" , err )
154+ }
155+ return fmt .Errorf ("worker exited unexpectedly during startup (no error)" )
156+ default :
157+ }
158+
149159 // Trigger the "simple" workflow if it exists in the config
150160 if len (workerConfig .Triggers ) > 0 {
151161 var simpleTrigger * worker.Trigger
@@ -159,12 +169,12 @@ func testWorkerDev(t *testing.T, workerConfig *worker.WorkerConfig, profile *pro
159169 if simpleTrigger != nil {
160170 t .Logf ("Triggering workflow using command: %s" , simpleTrigger .Command )
161171 triggerCtx , triggerCancel := context .WithTimeout (ctx , 30 * time .Second )
162- if err := executeTriggerCommand (triggerCtx , simpleTrigger .Command , profile ); err != nil {
163- t .Logf ("Warning: failed to trigger workflow: %v" , err )
164- } else {
165- t .Log ("Successfully triggered workflow" )
166- }
172+ err := executeTriggerCommand (triggerCtx , simpleTrigger .Command , profile )
167173 triggerCancel ()
174+ if err != nil {
175+ return fmt .Errorf ("failed to trigger workflow: %w" , err )
176+ }
177+ t .Log ("Successfully triggered workflow" )
168178 }
169179 }
170180
@@ -176,14 +186,13 @@ func testWorkerDev(t *testing.T, workerConfig *worker.WorkerConfig, profile *pro
176186 select {
177187 case err := <- errChan :
178188 if err != nil {
179- return err
189+ return fmt . Errorf ( "worker process error: %w" , err )
180190 }
181- case <- time .After (2 * time .Second ):
182- // Worker process should have stopped by now
183- t .Log ("Worker process cleanup timeout - continuing anyway" )
191+ case <- time .After (5 * time .Second ):
192+ t .Log ("Worker process cleanup timeout after cancel" )
184193 }
185194
186- t .Log ("Worker ran successfully and workflow was triggered " )
195+ t .Log ("Worker ran successfully" )
187196 return nil
188197}
189198
0 commit comments