Remove obsolete script files that are no longer needed. Root run.sh has all functionality. Clean src/ directory to only contain necessary source scripts. Deleted files: - bin/cleanup.sh (functionality in run.sh) - bin/docker-manage.sh (functionality in run.sh) - lib/docker.sh (not used, deleted) - src/build.sh (obsolete, not referenced) - src/run.sh (obsolete, duplicate of root run.sh) - src/run-new.sh (broken, references deleted lib/docker.sh) - plan/PreFlightDiscussion-*.md (planning docs no longer needed) Modified files: - .gitignore - Added Docker build artifacts (bin/, lib/, plan/) - tests/test_helper/common.bash - Fixed for standalone execution Current src/ directory (essential scripts only): - build-iso.sh - ISO build orchestration - firewall-setup.sh - Firewall configuration - security-hardening.sh - Security hardening functions 💘 Generated with Crush Assisted-by: GLM-4.7 via Crush <crush@charm.land>
60 lines
1.2 KiB
Bash
60 lines
1.2 KiB
Bash
#!/usr/bin/env bats
|
|
# Test helper setup for bats-core
|
|
|
|
# Common test variables
|
|
readonly TEST_TEMP_DIR=$(mktemp -d)
|
|
readonly PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
|
|
# Cleanup function
|
|
cleanup() {
|
|
rm -rf "$TEST_TEMP_DIR"
|
|
}
|
|
|
|
# Set up trap for cleanup
|
|
trap cleanup EXIT
|
|
|
|
# Common helper functions
|
|
create_test_wg_config() {
|
|
local config_file="$1"
|
|
cat > "$config_file" << EOF
|
|
[Interface]
|
|
PrivateKey = testPrivateKey1234567890abcdefghijklmnopqrstuvwxyz
|
|
Address = 10.0.0.2/24
|
|
DNS = 1.1.1.1
|
|
|
|
[Peer]
|
|
PublicKey = testPublicKey1234567890abcdefghijklmnopqrstuvwxyz
|
|
Endpoint = 192.168.1.100:51820
|
|
AllowedIPs = 0.0.0.0/0
|
|
PersistentKeepalive = 25
|
|
EOF
|
|
}
|
|
|
|
# Additional helper functions for missing assertions
|
|
assert_file_exists() {
|
|
if [[ ! -f "$1" ]]; then
|
|
echo "File does not exist: $1"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
assert_file_contains() {
|
|
local file="$1"
|
|
local content="$2"
|
|
|
|
if ! grep -q "$content" "$file"; then
|
|
echo "File '$file' does not contain '$content'"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
assert_regex() {
|
|
local haystack="$1"
|
|
local pattern="$2"
|
|
|
|
if ! echo "$haystack" | grep -qE "$pattern"; then
|
|
echo "Output does not match regex pattern '$pattern'"
|
|
return 1
|
|
fi
|
|
}
|