mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
test(cli): devvm space's backend timeout is a test-build setting, so the space script doesn't depend on load
A test build's Host reads DEVVM_TEST_LIST_TIMEOUT (platform.TestListWait):
comma-separated durations, each for every backend ("10m") or one
("smolvm:1s"), one backend's winning. spaceTimeout(backend) reads it
through registry.Host(), so a release always waits 30 s. devvm space's
listings and strays and gc --caches' cache listing use it.
The CLI tests' fakeHost sets 10m for every script. space.txtar adds a
case where smolvm's listing hangs (the stub's smolvm-ls-hangs) past a
1 s smolvm timeout: smolvm is named (space_backend_unknown) and its VM's
state isn't a leftover. TestListTimeout covers the parsing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
7 files changed
+87
-7
No files matched your search
Vendored
+11
@@ -76,6 +76,17 @@ exec devvm space
|
||||
stderr '^space_backend_unknown backend=smolvm$'
|
||||
stdout '^leftover state +- +1 '
|
||||
|
||||
# A backend slower than the timeout is named the same way, and its VMs
|
||||
# aren't leftovers either.
|
||||
rm $STUB_DIR/smolvm-ls-fails
|
||||
exec sh -c 'touch "$STUB_DIR/smolvm-ls-hangs"'
|
||||
env DEVVM_TEST_LIST_TIMEOUT=10m,smolvm:1s
|
||||
exec devvm space
|
||||
stderr '^space_backend_unknown backend=smolvm$'
|
||||
stdout '^leftover state +- +1 '
|
||||
rm $STUB_DIR/smolvm-ls-hangs
|
||||
env DEVVM_TEST_LIST_TIMEOUT=10m
|
||||
|
||||
# Lima's download cache, which every Lima home shares: shown apart.
|
||||
[darwin] mkdir $HOME/Library/Caches/lima/download/by-url-sha256/0123
|
||||
[darwin] exec sh -c 'echo x > "$HOME/Library/Caches/lima/download/by-url-sha256/0123/data"'
|
||||
|
||||
Vendored
+2
-1
@@ -2,7 +2,7 @@
|
||||
# Stand-in for smolvm in tests. Logs every call to $STUB_LOG. Its machines are files in
|
||||
# $STUB_DIR/smolvm/: one per machine, "STATE CPUS MEM_MIB STORAGE_GB NET LABEL", which create,
|
||||
# start, stop, update and delete keep up to date; machine ls --json answers from them, and fails
|
||||
# with $STUB_DIR/smolvm-ls-fails. A machine
|
||||
# with $STUB_DIR/smolvm-ls-fails (hangs 30 s with $STUB_DIR/smolvm-ls-hangs). A machine
|
||||
# with $STUB_DIR/smolvm-foreign-NAME has another label (someone else's). start fails with
|
||||
# $STUB_DIR/smolvm-start-fails, leaving it stopped, and records the SSH agent it was given
|
||||
# ($SSH_AUTH_SOCK, or "unset") to $STUB_DIR/smolvm-agent-NAME. exec answers the libc check
|
||||
@@ -68,6 +68,7 @@ json_list() { local s="" w; for w in "$@"; do s+="${s:+,}\"$w\""; done; echo "[$
|
||||
case $cmd in
|
||||
"machine ls")
|
||||
[[ ! -e $STUB_DIR/smolvm-ls-fails ]] || { echo "smolvm: the engine didn't answer" >&2; exit 1; }
|
||||
[[ ! -e $STUB_DIR/smolvm-ls-hangs ]] || exec sleep 30
|
||||
sep="" out="["
|
||||
for m in "$dir"/*; do
|
||||
[[ -f $m ]] || continue
|
||||
|
||||
Reference in new issue
Block a user