Skip to content

Commit 9fbd7d4

Browse files
Marketenclaude
andcommitted
Capture d-i consoles and guest state when an e2e run fails
A failed run only tailed the serial logs, which hold three lines of EFI stub output because d-i draws its UI on VT1 and streams its syslog to VT4, and the first-boot test runs on a virtual terminal via openvt. Both real failures found so far were invisible in the artifacts. Screendump every console instead, and dump the guest's install logs, docker state and connectivity over SSH, which is always up by the time a first-boot wait times out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 68cea42 commit 9fbd7d4

1 file changed

Lines changed: 46 additions & 8 deletions

File tree

‎test/e2e_iso_install.sh‎

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,53 @@ run_e2e_iso_install() {
8484
}
8585
trap cleanup_e2e_vm EXIT INT TERM
8686

87+
monitor_command() {
88+
local socket=$1
89+
local command=$2
90+
[ -S "${socket}" ] || return 0
91+
printf '%s\n' "${command}" | \
92+
socat - "UNIX-CONNECT:${socket}" >/dev/null 2>&1 || true
93+
}
94+
95+
capture_vt_screens() {
96+
# d-i draws its UI on VT1 and streams its syslog to VT4, so a failed
97+
# installer step is only diagnosable if every console is captured.
98+
local socket=$1
99+
local prefix=$2
100+
local vt
101+
[ -S "${socket}" ] || return 0
102+
for vt in 1 2 3 4; do
103+
monitor_command "${socket}" "sendkey alt-f${vt}"
104+
sleep 1
105+
monitor_command "${socket}" "screendump ${prefix}-vt${vt}.ppm"
106+
done
107+
monitor_command "${socket}" "sendkey alt-f1"
108+
}
109+
110+
dump_guest_diagnostics() {
111+
# SSH is already up whenever a first-boot wait times out, and the
112+
# installer logs there explain far more than the serial console can.
113+
declare -F ssh_guest >/dev/null 2>&1 || return 0
114+
echo "[INFO] Collecting guest diagnostics over SSH:"
115+
ssh_guest "
116+
echo '--- .firstboot ---'; ls -la /usr/src/dappnode/.firstboot 2>&1
117+
echo '--- dappnode processes ---'; ps aux | grep -E '[d]appnode_(test_)?install' 2>&1
118+
echo '--- docker ps ---'; docker ps --format '{{.Names}}\t{{.Status}}' 2>&1
119+
echo '--- docker images ---'; docker images 2>&1
120+
echo '--- connectivity ---'
121+
ping -c 1 -W 5 google.com 2>&1 | tail -3
122+
curl -sS -o /dev/null -w 'curl https: %{http_code}\n' --max-time 10 https://www.google.com/generate_204 2>&1
123+
echo '--- iso_install.log ---'; tail -n 60 /usr/src/dappnode/logs/iso_install.log 2>&1
124+
echo '--- dappnode_install.log ---'; tail -n 80 /usr/src/dappnode/logs/dappnode_install.log 2>&1
125+
" 2>&1 | sed 's/^/ /' || echo " [WARN] Could not collect guest diagnostics"
126+
}
127+
87128
show_failure_logs() {
88-
if [ -S "${installer_monitor_socket}" ]; then
89-
printf 'screendump %s\n' "${installer_screenshot}" | \
90-
socat - "UNIX-CONNECT:${installer_monitor_socket}" >/dev/null 2>&1 || true
91-
fi
92-
if [ -S "${first_boot_monitor_socket}" ]; then
93-
printf 'screendump %s\n' "${first_boot_screenshot}" | \
94-
socat - "UNIX-CONNECT:${first_boot_monitor_socket}" >/dev/null 2>&1 || true
95-
fi
129+
capture_vt_screens "${installer_monitor_socket}" "${output_dir}/installer-screen"
130+
capture_vt_screens "${first_boot_monitor_socket}" "${output_dir}/first-boot-screen"
131+
monitor_command "${installer_monitor_socket}" "screendump ${installer_screenshot}"
132+
monitor_command "${first_boot_monitor_socket}" "screendump ${first_boot_screenshot}"
133+
dump_guest_diagnostics
96134
echo "[INFO] Last installer serial output:"
97135
tail -n 200 "${installer_serial_log}" 2>/dev/null || true
98136
echo "[INFO] Last first-boot serial output:"

0 commit comments

Comments
 (0)