Test Fixes: - Fixed grep regex matching `test:iso)` instead of `iso|iso:demo)` by using `grep -F` for literal string matching in 3 test files - Increased grep context from -A 5 to -A 15 for FDE reference tests since FDE mention is 9+ lines into the iso command block Stale Files: - Deleted test-iso.sh (merged into run.sh in Session 4) - Deleted verify.sh (orphaned, never referenced anywhere) Documentation: - Fixed stale test file references in COMPLIANCE.md - Updated TEST-COVERAGE.md to remove "delegates to test-iso.sh" - Added JOURNAL.md entry with full audit findings - Updated STATUS.md timestamp NVMe Build Cache (from previous session, was uncommitted): - Added Docker volume `knel-football-cache` for build caching - Added `clean:cache` and `cache` commands to run.sh - Cache preserves bootstrap + package downloads between builds Test Results: 786 pass, 0 fail, 16 VM skip 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
141 lines
3.7 KiB
Bash
141 lines
3.7 KiB
Bash
#!/usr/bin/env bats
|
|
# KNEL-Football Unit Tests - run.sh Basic Tests
|
|
# Reference: PRD.md FR-010 (ISO Build Process)
|
|
# Copyright © 2026 Known Element Enterprises LLC
|
|
# License: GNU Affero General Public License v3.0 only
|
|
|
|
# =============================================================================
|
|
# File Existence and Properties
|
|
# =============================================================================
|
|
|
|
@test "run.sh exists" {
|
|
[ -f "/workspace/run.sh" ]
|
|
}
|
|
|
|
@test "run.sh is executable" {
|
|
[ -x "/workspace/run.sh" ]
|
|
}
|
|
|
|
@test "run.sh is a valid bash script" {
|
|
run bash -n /workspace/run.sh
|
|
[ "$status" -eq 0 ]
|
|
}
|
|
|
|
@test "run.sh uses strict mode" {
|
|
grep -q "set -euo pipefail" /workspace/run.sh
|
|
}
|
|
|
|
# =============================================================================
|
|
# Basic Commands
|
|
# =============================================================================
|
|
|
|
@test "run.sh help command shows usage" {
|
|
run bash /workspace/run.sh help
|
|
[ "$status" -eq 1 ]
|
|
[[ "$output" == *"Usage"* ]] || [[ "$output" == *"Commands"* ]]
|
|
}
|
|
|
|
@test "run.sh help mentions build" {
|
|
run bash /workspace/run.sh help
|
|
[[ "$output" == *"build"* ]]
|
|
}
|
|
|
|
@test "run.sh help mentions test" {
|
|
run bash /workspace/run.sh help
|
|
[[ "$output" == *"test"* ]]
|
|
}
|
|
|
|
@test "run.sh help mentions iso" {
|
|
run bash /workspace/run.sh help
|
|
[[ "$output" == *"iso"* ]]
|
|
}
|
|
|
|
@test "run.sh without arguments shows usage" {
|
|
run bash /workspace/run.sh
|
|
[ "$status" -eq 1 ]
|
|
}
|
|
|
|
# =============================================================================
|
|
# Docker Integration
|
|
# =============================================================================
|
|
|
|
@test "run.sh uses Docker image knel-football-dev" {
|
|
grep -q "knel-football-dev" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh mounts workspace in Docker" {
|
|
grep -q "/workspace" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh mounts output directory in Docker" {
|
|
grep -q "/output" /workspace/run.sh
|
|
}
|
|
|
|
# =============================================================================
|
|
# Test Commands
|
|
# =============================================================================
|
|
|
|
@test "run.sh has test:unit command" {
|
|
grep -q "test:unit)" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh has test:integration command" {
|
|
grep -q "test:integration)" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh has test:security command" {
|
|
grep -q "test:security)" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh has test:system command" {
|
|
grep -q "test:system)" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh has lint command" {
|
|
grep -q "lint)" /workspace/run.sh
|
|
}
|
|
|
|
# =============================================================================
|
|
# VM Test Commands
|
|
# =============================================================================
|
|
|
|
@test "run.sh has test:iso command" {
|
|
grep -q "test:iso)" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh test:iso checks prerequisites" {
|
|
grep -q "vm_check_prerequisites" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh has VM create command" {
|
|
grep -q "vm_create" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh has VM destroy command" {
|
|
grep -q "vm_destroy" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh has VM console command" {
|
|
grep -q "vm_console" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh has VM status command" {
|
|
grep -q "vm_status" /workspace/run.sh
|
|
}
|
|
|
|
# =============================================================================
|
|
# Security Requirements
|
|
# =============================================================================
|
|
|
|
@test "run.sh has host FDE check" {
|
|
grep -q "check_host_fde" /workspace/run.sh
|
|
}
|
|
|
|
@test "run.sh references host FDE for iso command" {
|
|
grep -A 15 -F 'iso|iso:demo)' /workspace/run.sh | grep -qi "fde\|encryption"
|
|
}
|
|
|
|
@test "run.sh has check_host_fde function" {
|
|
grep -q "check_host_fde()" /workspace/run.sh
|
|
}
|