tests/e2e: KEEP=on-failure keeps the VM of a failed run and lists kept VMs
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 15/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- bash
- Ambito
- ci-cd, testing-qa
Direzione di ricerca
Start in tests/e2e/lib/vm.sh, next to vm_running and vm_kill, and in on_exit and write_results in tests/e2e/run.sh, which hold the KEEP and N_FAILED logic. The loader, tests/e2e-harness.sh and --print-config come from #170, which must merge first. Done when keep_vm and kept_vms pass the no-root cases and the e2e-harness step in the lint workflow, and docs/e2e-tests.md is updated.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Epic #164 · Milestone Phase 1: Community & CI · Priority low · Size S · Depends on #170
Why
--keep keeps the VM of every run, so you have to choose before you know you need it. Playwright keeps a trace when a test fails; here the VM is the trace.
With KEEP=on-failure as the local default, a failed run leaves its VM ready for ssh, and a passed run cleans up after itself. CI never keeps one.
Kept VMs then add up (RAM and a disk of several GB each), so the harness must point at them and say how to remove them.
What to do
-
KEEP=never|on-failure|alwaysin the loader of #170:on-failureine2e.cfg,neverin its CI branch,E2E_KEEPin the environment. A bad value exits 2 with a message that namesKEEP.--helplists it.--keepstill works, meansalways, and wins over the files andE2E_KEEP.- The setting replaces the
KEEP=0/1variable ofrun.sh.
-
keep_vmintests/e2e/lib/vm.sh, next tovm_runningandvm_kill. That file is sourced and has no side effects, so a test can call it;run.shcannot be sourced. It returns 0 when the VM stays:alwaysyes,neverno,on-failurewhen the run failed by the rule ofstatusinwrite_results(N_FAILED > 0, orABORTset: time limit, interrupted). -
on_exitcallskeep_vmonce, at its top, or right afterclose_open_scenarioof #172 when that has merged, since that call can record a failed scenario. Whichever PR merges second keeps that order. Both of today's[[ $KEEP -eq 1 ]]tests use that answer: the one beforevm_killand the one that chooses between printing the kept VM andrm -rf "$WORK".run.shruns withset -u, so a-eqtest left on a stringKEEPstopson_exitbeforewrite_results. - A kept VM prints three things:
- its folder;
- the SSH command, as today: to
127.0.0.1on the forwarded port,$P822withkeys/panelwhenCHANNELisroot, else$P22withkeys/ops; - a stop command that also frees the disk:
kill $(cat DIR/qemu.pid) && rm -rf DIR, or onlyrm -rf DIRwhen the VM is not running. - Today these lines come before the summary line (
<os>: N passed, ...). Move them after it, and after the MP4 lines of #175 when that has merged, so they are the last lines of the run. Only the printing moves:rm -rf "$WORK"for a VM that is not kept stays before the summary line, as #175 expects. Whichever of the two PRs merges second keeps this order. - Write the same lines to
$WORK/kept-vm.txtbefore the summary line, so a Ctrl-C later inon_exitcannot lose them. That file marks a kept folder.
-
kept_vmsinlib/vm.shlists every$CACHE_DIR/runs/*/kept-vm.txt. UseCACHE_DIR:E2E_CACHEmay be unset.- VM running: print its
kept-vm.txt. - VM stopped: the folder, its size (
du -sh) andrm -rf DIR. - "Running" means the PID in
qemu.pidis alive and/proc/PID/cmdlineholds that folder'sdisk.qcow2. After a host reboot, an old PID can belong to another process. - A folder without
kept-vm.txtcan be a run in progress:mktemp -dmakes it before the VM starts, and QEMU writesqemu.piditself (-pidfile) as soon as it starts. So it is never listed, and two runs at once, or #177, do not report each other's VMs. - For the same reason, folders kept by today's
--keepand runs killed beforeon_exitare not listed either, even with a live QEMU. Examples: the SIGKILL oftimeout --kill-after=1mine2e.yml, or a closed terminal. The docs say how to find them by hand (below).
- VM running: print its
-
run.shcallskept_vmsbefore the first scenario, as a warning that does not change the run. - No-root test: add these cases to
tests/e2e-harness.shfrom #170. They sourcelib/vm.shandlib/record.shwith temporaryWORK,OUTandCACHE_DIR.- The lint workflow already runs that file: #170 adds its step.
keep_vmfor each mode with a passed run, a failed one (N_FAILED=1) and an interrupted one (ABORT=interrupted).- The loader cases need the resolved
KEEP.run.shcannot show it today: it has three modes only (run,--list-os,--image-key), and its parsing is top-level code. These cases userun.sh --print-configfrom #170: it prints each resolved setting as aKEY=value (source)line, such asKEEP=always (--keep), and exits 0 before the QEMU tool check, like--list-os. - The three loader cases:
--keepwins overE2E_KEEP=never(printsKEEP=always);CI=truegivesKEEP=never;E2E_KEEP=sometimesexits 2 with a message that namesKEEP(exit 2 alone also means a missing--osor a missing QEMU). The local cases run underenv -u CI: GitHub Actions setsCI=truein the lint job too. kept_vms: a kept folder with a live fake VM is listed with its kill command. The fake VM is a background process whose command line holds the folder'sdisk.qcow2, for examplebash -c 'sleep 300; :' qemu "file=$dir/disk.qcow2". A kept folder whose PID is dead is listed as stopped, with itsrm -rf. A live fake VM withoutkept-vm.txtis not listed.
-
docs/e2e-tests.md: theKEEProw of the settings table. The--keepline becomesKEEP: how to log in to a kept VM, how to stop it and free its disk, and the warning at the start of a run.- Say which folders the warning does not list (runs in progress, old
--keepfolders, killed runs) and how to find them:ls ~/.cache/server-prep-e2e/runs/andpgrep -af 'qemu-system-x86_64 -name e2e-'(QEMU runs with-name e2e-<os>).
- Say which folders the warning does not list (runs in progress, old
-
CHANGELOG.md: a line that says a failed local run now keeps its VM.
Acceptance criteria
- The no-root cases cover the nine
keep_vmcases, the three loader cases (throughrun.sh --print-config) and the threekept_vmscases. - A step of the lint workflow runs
tests/e2e-harness.sh, whereCI=true, and it passes. -
tests/e2e/run.sh --os debian-13 --only audit-fresh(it runsbootandaudit-freshonly) passes, prints nokept:line, and leaves no new folder in the cache'sruns/and no new QEMU process. -
E2E_FAIL_SCENARIO=audit-fresh tests/e2e/run.sh --os debian-13 --only audit-fresh(the test hook of #170) exits 1. Its last lines are the kept folder, an SSH command that logs in and a stop command that leaves no QEMU process and no folder. - A run started while that VM is kept lists it in the start warning. After a plain
kill, it is listed as stopped, with its size. -
--keepstill keeps the VM of a passed run. -
docs/e2e-tests.mdnames the folders the warning does not list and the two commands that find them. - The e2e workflow passes on this PR, and its
harness.logfiles have nokept:line. - ShellCheck stays clean.
Not in this issue
- The loader,
tests/e2e-harness.sh,--print-configand theE2E_FAIL_SCENARIOtest hook: #170. - The MP4 lines printed after the summary: #175.
- At the end of a run of several systems, printing every kept VM with
kept_vms: #177.
- Lingua principale
- Shell
- Stelle
- 2
- Fork
- 3
- Merge medio
- 2g 14m
- PR unite (30g)
- 47
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di exceev-consulting/server-prep
-
area: docs bug claude documentation good first issue priority: low size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
exceev-consulting/server-prep#225 ·
I maintainer di solito rispondono entro 2 giorni
-
area: preconfig bug claude priority: medium size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
exceev-consulting/server-prep#224 ·
I maintainer di solito rispondono entro 2 giorni
-
claude enhancement priority: low size: S
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
exceev-consulting/server-prep#222 ·
I maintainer di solito rispondono entro 2 giorni
-
e2e flake: boot fails on debian-13 when its genericcloud image is missing from SHA512SUMSForse già presa @exceev-claude l’ha presa 1 giorno fa. Apertaarea: ci bug claude priority: high size: S
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
exceev-consulting/server-prep#212 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
server-audit.sh: flag world-writable directories in /etc such as /etc/dokploy (GHSA-qxjv-6cvh-32c6)Apertaarea: audit claude enhancement panel: dokploy priority: high security size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
exceev-consulting/server-prep#211 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di exceev-consulting/server-prep
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/kernels#1006 ·
I maintainer di solito rispondono entro 1 giorno
-
severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
luainkernel/lunatik#2594 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
cardano-community/guild-operators#1930 ·
I maintainer di solito rispondono entro 1 giorno
-
out-of-date
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
CachyOS/CachyOS-PKGBUILDS#2136 ·
I maintainer di solito rispondono entro 1 giorno