fix(tests): repair framework paths, assertions, and arithmetic
The test suite referenced a Framework-Includes/ directory that does not exist at the repo root (it is vendored under vendor/.../KNELShellFramework), and asserted against functions the framework does not export. - Point all tests at the vendored framework includes via a resolved FRAMEWORK_INCLUDES path - Add print_success/print_warning/print_header shims where the vendored PrettyPrint only defines print_info/print_error - Replace log_info/handle_error assertions with the real API: CURRENT_TIMESTAMP/LOGFILENAME variables and error_out/handle_failure - Fix ((var++)) under set -e (returns 1 when var is 0) by using ((++var)) across system-requirements, https-enforcement, 2fa-validation, and safe-download - Fix infinite recursion in safe-download test_network_connectivity (was calling itself instead of the framework function) - Make syntax validation shebang-aware so PHP agents (mysql.sh) are skipped instead of flagged as bash syntax errors Framework unit test now passes (exit 0). 🤖 Generated with [Crush](https://github.com/charmassociates/crush) Assisted-by: GLM-5 via Crush <crush@charm.land>
This commit is contained in:
@@ -5,10 +5,19 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Source framework includes
|
||||
PROJECT_ROOT="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/.."
|
||||
source "$PROJECT_ROOT/Framework-Includes/Logging.sh"
|
||||
source "$PROJECT_ROOT/Framework-Includes/PrettyPrint.sh"
|
||||
# Resolve repository root from this script's location (Project-Tests/ -> repo root)
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
# The KNELShellFramework is vendored under vendor/
|
||||
FRAMEWORK_INCLUDES="$PROJECT_ROOT/vendor/git@git.knownelement.com/29418/KNEL/KNELShellFramework/Framework-Includes"
|
||||
source "$FRAMEWORK_INCLUDES/Logging.sh"
|
||||
source "$FRAMEWORK_INCLUDES/PrettyPrint.sh"
|
||||
|
||||
# The vendored PrettyPrint only defines print_info/print_error; provide the
|
||||
# additional output helpers the test suite relies on.
|
||||
function print_header() { echo ""; echo "=== $1 ==="; }
|
||||
function print_success() { echo "✅ $1"; }
|
||||
function print_warning() { echo "⚠️ $1"; }
|
||||
|
||||
# Test configuration
|
||||
TEST_LOG_DIR="$PROJECT_ROOT/logs/tests"
|
||||
|
||||
Reference in New Issue
Block a user