File tree Expand file tree Collapse file tree
scripts/e2e/lib/openai-web-search-minimal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,14 +22,8 @@ mock_pid=""
2222gateway_pid=" "
2323
2424cleanup () {
25- if [ -n " ${gateway_pid:- } " ] && kill -0 " $gateway_pid " 2> /dev/null; then
26- kill " $gateway_pid " 2> /dev/null || true
27- wait " $gateway_pid " 2> /dev/null || true
28- fi
29- if [ -n " ${mock_pid:- } " ] && kill -0 " $mock_pid " 2> /dev/null; then
30- kill " $mock_pid " 2> /dev/null || true
31- wait " $mock_pid " 2> /dev/null || true
32- fi
25+ openclaw_e2e_terminate_gateways " ${gateway_pid:- } "
26+ openclaw_e2e_stop_process " ${mock_pid:- } "
3327}
3428trap cleanup EXIT
3529
@@ -73,22 +67,8 @@ for _ in $(seq 1 80); do
7367done
7468node -e " fetch('http://127.0.0.1:${MOCK_PORT} /health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))" > /dev/null
7569
76- node " $entry " gateway --port " $PORT " --bind loopback --allow-unconfigured > " $GATEWAY_LOG " 2>&1 &
77- gateway_pid=" $! "
78- for _ in $( seq 1 360) ; do
79- if ! kill -0 " $gateway_pid " 2> /dev/null; then
80- echo " gateway exited before listening" >&2
81- exit 1
82- fi
83- if node " $entry " gateway health \
84- --url " ws://127.0.0.1:$PORT " \
85- --token " $TOKEN " \
86- --timeout 120000 \
87- --json > /dev/null 2>&1 ; then
88- break
89- fi
90- sleep 0.25
91- done
70+ gateway_pid=" $( openclaw_e2e_start_gateway " $entry " " $PORT " " $GATEWAY_LOG " ) "
71+ openclaw_e2e_wait_gateway_ready " $gateway_pid " " $GATEWAY_LOG " 360
9272node " $entry " gateway health \
9373 --url " ws://127.0.0.1:$PORT " \
9474 --token " $TOKEN " \
Original file line number Diff line number Diff line change @@ -1773,6 +1773,20 @@ test -f "$TMPDIR/docker-cmd-seen"
17731773 expect ( client ) . not . toContain ( '"agent.wait"' ) ;
17741774 } ) ;
17751775
1776+ it ( "cleans OpenAI web search smoke processes through the E2E helpers" , ( ) => {
1777+ const scenario = readFileSync ( OPENAI_WEB_SEARCH_MINIMAL_SCENARIO_PATH , "utf8" ) ;
1778+
1779+ expect ( scenario ) . toContain ( 'openclaw_e2e_terminate_gateways "${gateway_pid:-}"' ) ;
1780+ expect ( scenario ) . toContain ( 'openclaw_e2e_stop_process "${mock_pid:-}"' ) ;
1781+ expect ( scenario ) . toContain (
1782+ 'gateway_pid="$(openclaw_e2e_start_gateway "$entry" "$PORT" "$GATEWAY_LOG")"' ,
1783+ ) ;
1784+ expect ( scenario ) . toContain ( 'openclaw_e2e_wait_gateway_ready "$gateway_pid" "$GATEWAY_LOG" 360' ) ;
1785+ expect ( scenario ) . not . toContain ( 'kill "$gateway_pid"' ) ;
1786+ expect ( scenario ) . not . toContain ( 'kill "$mock_pid"' ) ;
1787+ expect ( scenario ) . not . toContain ( 'node "$entry" gateway --port "$PORT"' ) ;
1788+ } ) ;
1789+
17761790 it ( "keeps ClawHub plugin Docker smoke hermetic by default" , ( ) => {
17771791 const runner = readFileSync ( PLUGINS_DOCKER_E2E_PATH , "utf8" ) ;
17781792 const sweep = readFileSync ( PLUGINS_DOCKER_SWEEP_PATH , "utf8" ) ;
You can’t perform that action at this time.
0 commit comments