diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-12 23:58:01 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-12 23:58:01 -0400 |
| commit | 19f4624749228fcbe385d1edf1d2542c036440ff (patch) | |
| tree | 961e815d2226178345f5ec7ec7cb82f23da34379 /scripts/test-configs/btrfs-mirror-luks.conf | |
| parent | 863ceeac8fdb10258a58d35bcee6874097fffc88 (diff) | |
| download | archangel-19f4624749228fcbe385d1edf1d2542c036440ff.tar.gz archangel-19f4624749228fcbe385d1edf1d2542c036440ff.zip | |
refactor: extract pure RAID logic to lib/raid.sh with bats coverage
Peel the testable pieces of get_raid_level() out of the 1600-line
installer monolith into installer/lib/raid.sh:
- raid_valid_levels_for_count(count) — replaces the inline option-list
builder in get_raid_level()
- raid_is_valid(level, count) — useful for unattended-config validation
- raid_usable_bytes(level, count, smallest, total) — usable-space math
- raid_fault_tolerance(level, count) — max tolerable disk failures
archangel now sources lib/raid.sh and uses raid_valid_levels_for_count
for the fzf option list. Fzf preview subshell still inlines its own
usable-bytes arithmetic (calling exported lib functions across preview
subshells is fragile; left for a later pass).
30 bats tests in tests/unit/test_raid.bats cover the full enumeration
table, every valid/invalid level-vs-count combo from 2 to 5 disks,
mixed-size mirror, and unknown-level error paths. make test: 53/53.
Diffstat (limited to 'scripts/test-configs/btrfs-mirror-luks.conf')
0 files changed, 0 insertions, 0 deletions
