Files
football/tests/unit/encryption-validation_test.bats
Charles N Wyble 589c14833d fix: standardize username to 'football' in all hooks (FINDING-008)
The preseed.cfg creates user 'football' but hooks referenced 'kneluser'.
This inconsistency would cause runtime failures during installation.

Changes:
- config/hooks/installed/encryption-validation.sh: s/kneluser/football/g
- config/hooks/live/usb-automount.sh: s/kneluser/football/g
- config/hooks/installed/install-scripts.sh: s/kneluser/football/g
- tests/unit/encryption-validation_test.bats: Add 5 tests for username consistency

Fixes: FINDING-008 (User account inconsistency)
Reference: PRD.md user account requirements

💘 Generated with Crush

Assisted-by: Claude via Crush <crush@charm.land>
2026-02-20 10:49:47 -05:00

50 lines
1.8 KiB
Bash

#!/usr/bin/env bats
# Unit tests for encryption-validation.sh hook
# Reference: PRD.md FR-001 (Full Disk Encryption)
@test "encryption-validation.sh exists and is executable" {
[ -f "/workspace/config/hooks/installed/encryption-validation.sh" ]
[ -x "/workspace/config/hooks/installed/encryption-validation.sh" ]
}
@test "Validation checks for LUKS2 format" {
grep -q "LUKS\|luks" /workspace/config/hooks/installed/encryption-validation.sh
}
@test "Validation checks for encryption status" {
grep -q "crypt\|Crypt" /workspace/config/hooks/installed/encryption-validation.sh
}
@test "Validation script uses set -e for error handling" {
grep -q "set -e" /workspace/config/hooks/installed/encryption-validation.sh
}
# =============================================================================
# USERNAME CONSISTENCY (FINDING-008)
# =============================================================================
@test "Username 'football' is consistent across all hook files" {
# preseed.cfg creates user 'football', hooks should reference same username
run grep -r "kneluser" /workspace/config/hooks/
[ "$status" -ne 0 ]
}
@test "Username in preseed.cfg is 'football'" {
grep -q "passwd/username string football" /workspace/config/includes.installer/preseed.cfg
}
@test "encryption-validation.sh uses correct username 'football'" {
# Should NOT reference 'kneluser'
! grep -q "kneluser" /workspace/config/hooks/installed/encryption-validation.sh
}
@test "usb-automount.sh uses correct username 'football'" {
# Should NOT reference 'kneluser'
! grep -q "kneluser" /workspace/config/hooks/live/usb-automount.sh
}
@test "install-scripts.sh uses correct username 'football'" {
# Should NOT reference 'kneluser'
! grep -q "kneluser" /workspace/config/hooks/installed/install-scripts.sh
}