Skip to content

Commit fa22a4c

Browse files
committed
test(ssh): the launcher harness's started server publishes its runtime record
Launches now wait up to ten seconds for a server they start to publish server-runtime.json. The harness's fake server never did, so every launch that started one sat out that wait on the wall clock while each poll advanced the fake clock. The fake server now records its pid, and the runtime read after a start returns it, as a real server's record would.
1 parent f3d97ce commit fa22a4c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎packages/ssh/src/launcherTestHarness.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ Date.now = () => Number(fs.readFileSync(process.env.HOME + '/clock', 'utf8'));
103103
`
104104
case "\${2:-}" in
105105
*/server-runtime.json)
106+
# A started server publishes its runtime record, which the launch waits for.
107+
if [ -e "$HOME/started-server" ]; then
108+
printf 'record %s\\n' "$(cat "$HOME/clock")" >> "$HOME/events"
109+
printf '%s 5999' "$(cat "$HOME/started-server")"
110+
exit 0
111+
fi
106112
NOW="$(cat "$HOME/clock")"
107113
printf 'runtime %s\\n' "$NOW" >> "$HOME/events"
108114
if [ "$NOW" -ge "$TEST_READY_AT" ] || [ -e "$2" ]; then printf '%s %s' "$TEST_SERVER_PID" 4888
@@ -138,7 +144,7 @@ if [ -n "$TEST_CLOCK_JUMP" ] && [ ! -e "$HOME/jumped" ]; then
138144
touch "$HOME/jumped"
139145
fi`,
140146
);
141-
executable("nohup", ":");
147+
executable("nohup", 'printf "%s" "$$" > "$HOME/started-server"');
142148
if (options.recordedKind) {
143149
const state = NodePath.join(home, ".t3/ssh-launch/test-target");
144150
NodeFS.mkdirSync(state, { recursive: true });

0 commit comments

Comments
 (0)