@@ -97,7 +97,14 @@ while true; do
9797 exit 1
9898 fi
9999
100- # Check if process is still alive
100+ # Check for success FIRST (before checking if process died)
101+ if grep -q " .*REST API bound to 0.0.0.0.*" " $OUTFILE " ; then
102+ >&2 echo " SUCCESS: Direct Client API is ready! Proceeding..."
103+ SUCCESS=true
104+ break
105+ fi
106+
107+ # Only check if process is still alive if we haven't found success yet
101108 if ! kill -0 $APP_PID 2> /dev/null; then
102109 >&2 echo " ERROR: Application process died unexpectedly after $(( TIMER / 10 )) seconds"
103110 >&2 echo " Dumping full log output for debugging:"
@@ -109,11 +116,6 @@ while true; do
109116 exit 1
110117 fi
111118
112- if grep -q " .*REST API bound to 0.0.0.0.*" " $OUTFILE " ; then
113- >&2 echo " SUCCESS: Direct Client API is ready! Proceeding..."
114- break
115- fi
116-
117119 # Log progress every 10 seconds (20 iterations)
118120 if (( TIMER % 100 == 0 && TIMER > 0 )) ; then
119121 >&2 echo " Still waiting for application to start... ($(( TIMER / 10 )) seconds elapsed)"
@@ -128,28 +130,21 @@ done
128130if kill -0 $APP_PID 2> /dev/null; then
129131 kill $APP_PID
130132 wait $APP_PID 2> /dev/null || true
131- RESULT=$?
132133else
133134 echo " Process $APP_PID already terminated"
134- RESULT=0 # Consider successful if process already exited
135135fi
136136
137137# Output logs
138138echo " ----- OUTPUT START -----"
139139cat " $OUTFILE "
140140echo " ----- OUTPUT END -----"
141141
142- # Check the application exit code
143- if [[ $RESULT -ne 0 ]]; then
144- echo " Error: 'pnpm start' command exited with an error (code: $RESULT ) "
145- exit 1
142+ # If we saw the REST API bind message, consider smoke test successful
143+ if [[ " ${SUCCESS :- false} " == " true " ]]; then
144+ echo " Smoke Test completed successfully - REST API bound successfully. "
145+ exit 0
146146fi
147147
148- # Final validation
149- if grep -q " Server closed successfully" " $OUTFILE " ; then
150- echo " Smoke Test completed successfully."
151- else
152- echo " Error: The output does not contain the expected termination message but was completed."
153- echo " Smoke Test completed without completion message."
154- # Exit gracefully
155- fi
148+ # If we got here without SUCCESS flag, something went wrong
149+ echo " Error: Smoke test did not complete successfully."
150+ exit 1
0 commit comments