Skip to content

Commit be9a908

Browse files
author
PR Batch Tester
committed
test(ssh): assert race synchronization sites exist
1 parent 7de7270 commit be9a908

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎packages/ssh/src/tunnel.test.ts‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,19 +510,28 @@ server.listen(Number(flag("--port")), "127.0.0.1", () => {
510510
const releaseFirst = yield* Deferred.make<void>();
511511
const releaseSecond = yield* Deferred.make<void>();
512512
const script = yield* fs.readFileString(launchScript);
513+
const transferSite = 'if cmp -s "$PREVIOUS_STATE_DIR/active-runner.sh" "$RUNNER_FILE"; then';
514+
const lockWaitSite = ' if [ "$LOCK_WAIT_COUNT" -ge 200 ]; then';
515+
assert.include(
516+
script,
517+
transferSite,
518+
"launch script is missing the transfer synchronization site",
519+
);
520+
assert.include(
521+
script,
522+
lockWaitSite,
523+
"launch script is missing the lock-wait synchronization site",
524+
);
513525
// Report lock contention while the first transfer is held, so the race
514526
// does not depend on subprocess scheduling.
515527
yield* fs.writeFileString(
516528
launchScript,
517529
script
518530
.replace(
519-
'if cmp -s "$PREVIOUS_STATE_DIR/active-runner.sh" "$RUNNER_FILE"; then',
531+
transferSite,
520532
'printf "transferring\\n"; read -r release; if cmp -s "$PREVIOUS_STATE_DIR/active-runner.sh" "$RUNNER_FILE"; then',
521533
)
522-
.replace(
523-
' if [ "$LOCK_WAIT_COUNT" -ge 200 ]; then',
524-
' printf "waiting\\n"; if [ "$LOCK_WAIT_COUNT" -ge 200 ]; then',
525-
),
534+
.replace(lockWaitSite, ' printf "waiting\\n"; if [ "$LOCK_WAIT_COUNT" -ge 200 ]; then'),
526535
);
527536
const first = yield* launch("first-alias", {
528537
onLine: (line) =>

0 commit comments

Comments
 (0)