Files
w3cjandClaude Opus 5.5 ecd266c7d3 test(cli): one wait for the scripts; the docs release job installs only what it builds with
The scripts waited with copies of the same loop: desktop.txtar's and
nix_cache.txtar's waitfor files, and sh -c loops in link_life,
fixture_v010_links, fixture_v010_small, ports and ports_stopped, each
with its own interval and limit. They now use one testscript command,
wait_until SCRIPT, which runs sh -c SCRIPT every 100 ms until it
succeeds, for up to 90 s, and fails at once when every background
command has ended, as wait_file does, or when SCRIPT exits 100
(waitGiveUp, a status no tool the scripts run gives), as the links
check does when its session has ended. Contributing's tests page names
it beside wait_file, whose limit it now says is 60 s.

The docs workflow's release job installed every tool in the tag's
mise.toml. It now installs only Go, Hugo by the name the tag gives it
(hugo-extended before Hugo 0.170) and Node when the tag draws its
diagrams, with --locked as mise-action did, picking them with mise's
own reading of the tag's mise.toml (mise ls --current --json, the tag's
file alone), and fails when the tag names no Hugo. MISE_AUTO_INSTALL is
off for the job, so mise run docs:diagrams and the shims install
nothing more, and a tool the pick missed fails the build. This job runs
only at a release, so it hasn't run yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 23:07:04 -07:00

84 lines
3.2 KiB
Plaintext

# Links in VMs' lives: the client's link session (devvm _links, the stub
# ssh standing in for its connections) starts with devvm link add on a
# running client and with each launch, warns of what it can't carry, and
# stops with the VM; devvm rm, gc --orphans and devvm ls know of links.
project db
exec devvm --network open --no-git-protect
exec devvm link publish 5432,80
project app
exec devvm --network open --no-git-protect
vm_name APP app
vm_name DB db
exec sh -c 'ls "$VMS"/*/run | grep "links.pid" || true'
! stdout .
# add on a running client: its setup sent again with the link's name, and
# its session started, which carries it.
exec devvm link add db 5432
stdout '^==> link_added name=db port=5432 '
! stdout setting_set
wait_until 'grep -qx "devvm links: 127\.77\.0\.1:5432: carried" "$APP_dir"/logs/links.log'
exec sh -c 'kill -0 "$(cat "$APP_dir"/run/links.pid)"'
exec sh -c 'ls "$RUN" | grep "^link-.*\.sock$"'
exec devvm ls
stdout '^NAME +STATUS +IMAGE +TOOLS +GIT +NET +LINKS +FOLDER$'
stdout '^devvm-app-[0-9a-f]{14} +Running +base +- +off +open +1 +/'
stdout '^devvm-db-[0-9a-f]{14} +Running +base +- +off +open +- +/'
exec devvm ls --json
stdout '"links": 1'
# A program in the client holding a link's address: that link fails alone,
# said at once.
exec sh -c 'echo 127.77.0.1:80 > "$STUB_DIR"/link-taken'
exec devvm link add db 80
stdout '^==> link_added name=db port=80 '
stderr '^devvm: link_port_taken name=db port=80 vm=devvm-app-[0-9a-f]{14}$'
rm $STUB_DIR/link-taken
# Stopped, its session goes with it, and its sockets; a stopped client
# gets a change at its next start.
exec devvm stop
exec sh -c 'pid=$(cat "$APP_dir"/run/links.pid 2>/dev/null) || exit 0; ! kill -0 "$pid" 2>/dev/null'
exec sh -c 'ls "$RUN" | grep "^link-.*\.sock$" || true'
! stdout .
exec devvm link rm db 80
stdout '^==> setting_set vm=devvm-app-[0-9a-f]{14}$'
# A launch with the target stopped: warned once, the target left stopped,
# and the session started all the same.
cd $WORK/db
exec devvm stop
cd $WORK/app
exec devvm
stderr -count=1 '^devvm: link_target_stopped target=devvm-db-[0-9a-f]{14} vm=devvm-app-[0-9a-f]{14}$'
exec sh -c 'kill -0 "$(cat "$APP_dir"/run/links.pid)"'
exec devvm ls
stdout '^devvm-db-[0-9a-f]{14} +Stopped '
# devvm network log says what it logs for an open VM.
exec devvm network log
stderr '^net_open_log vm=devvm-app-[0-9a-f]{14}$'
# A session killed leaves its sockets: gc --orphans deletes them, and the
# links to a VM whose state is gone.
exec sh -c 'kill -9 "$(cat "$APP_dir"/run/links.pid)"'
exec sh -c 'ls "$RUN" | grep "^link-.*\.sock$"'
exec devvm space
stdout '^leftover state +[12] '
rm $DB_dir/vm.json
exec devvm gc --orphans --force
stdout '^gc_dead_links count=1$'
stdout '^gc_dead_link name=db port=5432 target=devvm-db-[0-9a-f]{14} vm=devvm-app-[0-9a-f]{14}$'
stdout '^gc_link_sockets count=[12]$'
stdout '^==> links_target_gone count=1 vm=devvm-db-[0-9a-f]{14} vms=devvm-app-[0-9a-f]{14}$'
stdout '^==> deleted_link_sockets count=[12]$'
exec sh -c 'ls "$RUN" | grep "^link-" || true'
! stdout .
vm_state $APP_dir/vm.json
! stdout '^links\.links'
# devvm rm of the client stops its session and takes its links with it.
exec devvm rm --force --no-export
! exists $APP_dir