Files
Coredesktop-Dev/tests/doctor.bats
T
davidandClaude Opus 5.5 9e4b78bb88 Use QEMU's standard VGA instead of virtio-vga
On Arch, -vga virtio needs qemu-hw-display-virtio-vga and also
qemu-hw-display-virtio-gpu, which that package doesn't depend on; with only
the first, QEMU segfaults at start without a message. The smoketest's VMs
are headless (or VNC), so -vga std, which qemu-base has, is enough. This
reverts 2207208's extra package and checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:13:13 -07:00

74 lines
2.2 KiB
Bash

#!/usr/bin/env bats
load test_helper
@test "doctor reports local changes in the deployed copy and how to fix them" {
make_working_copy
echo "# edited" >> "$DEPLOYED/update"
run cdd doctor
[ "$status" -eq 1 ]
[[ "$output" == *"PROBLEM the deployed copy has local changes"* ]]
[[ "$output" == *"M update"* ]]
[[ "$output" == *"coredesktop-dev deployed restore"* ]]
}
@test "doctor is happy with a clean deployed copy that can fast-forward" {
make_working_copy
# Upstream moves on; the deployed copy is behind, which is fine
git -C "$WC" commit -q --allow-empty -m "new"
git -C "$WC" push -q origin main
run cdd doctor
[[ "$output" == *"ok the deployed copy has no local changes"* ]]
[[ "$output" == *"ok the deployed copy can fast-forward to its upstream"* ]]
[[ "$output" == *"ok working copy: $WC"* ]]
}
@test "doctor reports a deployed copy with commits upstream doesn't have" {
make_working_copy
git -C "$DEPLOYED" commit -q --allow-empty -m "local commit"
run cdd doctor
[ "$status" -eq 1 ]
[[ "$output" == *"has commits its upstream doesn't"* ]]
}
@test "doctor reports a missing working copy" {
run cdd doctor
[ "$status" -eq 1 ]
[[ "$output" == *"PROBLEM no working copy is set"* ]]
}
@test "doctor reports when it was run from a Flatpak" {
make_working_copy
COREDESKTOP_DEV_VIA_FLATPAK=1 run cdd doctor
[[ "$output" == *"note you ran this in a Flatpak"* ]]
}
@test "doctor reports the pre-push hook" {
make_working_copy
run cdd doctor
[[ "$output" == *"the pre-push hook isn't installed"* ]]
cdd hooks install
run cdd doctor
[[ "$output" == *"ok the pre-push hook is installed"* ]]
}
@test "in a Flatpak, coredesktop-dev re-runs itself on the host" {
stub flatpak-spawn
FLATPAK_ID=com.vscodium.codium run cdd doctor
[ "$status" -eq 0 ]
called flatpak-spawn --host --env=COREDESKTOP_DEV_VIA_FLATPAK=1 \
"$(readlink -f "$PROJECT/bin/coredesktop-dev")" doctor
}
@test "--help works in a Flatpak without going to the host" {
stub flatpak-spawn
FLATPAK_ID=com.vscodium.codium run cdd doctor --help
[ "$status" -eq 0 ]
[[ "$output" == *"Usage: coredesktop-dev doctor"* ]]
not_called flatpak-spawn
}