phoebus_os/installer/tests/test_install_dryrun.sh
Phoebus 38214ea9e7 chore: import Phoebus OS installer and Rust migration
Initial public import of the proven Bash installer (installer/) and the production Rust workspace (installer-rs/). The reference ISO, build output and local agent transcripts are gitignored.

Verified: installer/tests/run_tests.sh and cargo test --workspace both pass.
2026-09-20 02:07:33 -07:00

32 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# shellcheck shell=bash
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
TEST_NAME="test_install_dryrun"
phoebus_test_setup
source "$PHOEBUS_ROOT/lib/confirm.sh"
source "$PHOEBUS_ROOT/lib/install.sh"
# A dry-run must never write to the configured install root.
config_set DRY_RUN "yes"
config_set TARGET_DISK "/dev/definitely-not-a-real-disk"
config_set INSTALL_ROOT "$STATE_DIR/host-root-should-stay-empty"
config_set USERNAME "tester"
install_effective_root >/dev/null
INSTALL_TARGET_ROOT="$(install_effective_root)"
assert_success "dry-run storage stage" install_stage_storage
assert_success "sandbox root created" test -d "$INSTALL_TARGET_ROOT"
assert_failure "host install root untouched" test -e "$(config_get INSTALL_ROOT)"
assert_success "dry-run base stage" install_stage_base
assert_success "dry-run portage stage" install_stage_portage
# scripts created by later stages stay inside the sandbox
assert_success "dry-run kernel profile writes to sandbox" install_stage_kernel
assert_success "kernel fragment in sandbox" test -e "$INSTALL_TARGET_ROOT/etc/kernel/config.d/00-phoebus-profile.config"
# preflight refuses an incomplete configuration (no real target disk)
config_set DRY_RUN "no"
assert_failure "preflight rejects incomplete config" install_preflight
phoebus_test_report