Files
devvm/testdata/script/fixture_v010_links.txtar
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

48 lines
2.3 KiB
Plaintext

# devvm 0.1.0's app and db VMs (testdata/v0.1.0/GOOS: see
# fixture_v010.txtar): app links to the port db publishes, 5432, as
# db.devvm.internal at 127.77.0.1. With db started first, app's launch
# says nothing of a stopped target, starts its link session, which
# carries the link at 0.1.0's address, and writes its links' list again
# for this sandbox. The setup it sends app names the resolver a
# confined VM's programs ask, and the paste folder, which 0.1.0's setup
# didn't have.
[!darwin] [!linux] skip 'a fixture for macOS and Linux only'
env GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t
mkdir $HOME/src/db $HOME/src/app $HOME/src/web $HOME/src/scratch
cd $HOME/src/app
exec git init -q -b main
exec git commit -q --allow-empty -m one
fixture v0.1.0
vm_name APP app
vm_name DB db
grep '"addr":"127\.77\.0\.1","port":5432,"target":"devvm-db-[0-9a-f]{14}"' $APP_dir/run/links.json
cd $HOME/src/db
exec devvm
stdout '^==> starting what=devvm-db-[0-9a-f]{14}$'
! stderr 'unreadable|corrupt|layout_|failed'
cd $HOME/src/app
exec devvm
stdout '^==> starting what=devvm-app-[0-9a-f]{14}$'
! stderr 'link_target_stopped|link_session_failed|link_port_taken'
! stderr 'unreadable|corrupt|layout_|failed'
wait_until 'grep -qx "devvm links: 127\.77\.0\.1:5432: carried" "$APP_dir"/logs/links.log && exit 0; if p=$(cat "$APP_dir"/run/links.pid 2>/dev/null) && ! kill -0 "$p" 2>/dev/null; then echo "the session ended"; cat "$APP_dir"/logs/links.log; exit 100; fi; cat "$APP_dir"/logs/links.log; exit 1'
exec sh -c 'kill -0 "$(cat "$APP_dir"/run/links.pid)"'
# The link as 0.1.0 had it (as above), and the list written again: its
# socket the session's own, in this sandbox's run folder.
grep '^\{"version":1,"links":\[\{"hosts":\["db","db\.devvm\.internal"\],"addr":"127\.77\.0\.1","port":5432,"target":"devvm-db-[0-9a-f]{14}","socket":"' $APP_dir/run/links.json
exec sh -c 's=$(sed -n "s/.*\"socket\":\"\([^\"]*\)\".*/\1/p" "$APP_dir/run/links.json") && test "$(dirname "$s")" = "$RUN" && test -S "$s"'
# The setup app got: its resolver, as a confined VM's, and the paste
# folder.
exec tar -xOf $STUB_DIR/sync.tar vm
stdout '^DEVVM_RESOLVER=''127\.0\.0\.1''$'
stdout '^DEVVM_PASTE_DIR=''/tmp/devvm-paste''$'
exec tar -xOf $STUB_DIR/sync.tar hosts
stdout 'db\.devvm\.internal'
exec devvm stop
cd $HOME/src/db
exec devvm stop