-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_clean_module_loading.sh
More file actions
executable file
·89 lines (70 loc) · 2.53 KB
/
test_clean_module_loading.sh
File metadata and controls
executable file
·89 lines (70 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
# Clean test of module loading with dependency resolution
echo "=== SENTINEL Clean Module Loading Test ==="
echo
export SENTINEL_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
# Set up environment
export SENTINEL_MODULES_PATH="${SENTINEL_ROOT}/bash_modules.d"
export MODULES_DIR="$SENTINEL_MODULES_PATH"
export SENTINEL_DEBUG_MODULES=0
export SENTINEL_QUIET_MODULES=0
export SENTINEL_SKIP_AUTO_LOAD=1 # Prevent automatic loading
# Source only the module functions without loading any modules
echo "Loading module system functions only..."
source "${SENTINEL_ROOT}/bash_modules"
echo
echo "=== Testing Individual Module Loading with Dependencies ==="
echo
# Test loading a module that has dependencies
echo "1. Testing config_cache (depends on: logging)"
echo " Initial state: No modules loaded"
echo
# Clear any loaded modules
unset SENTINEL_LOADED_MODULES
declare -gA SENTINEL_LOADED_MODULES
echo " Loading config_cache..."
module_enable "config_cache" 0 "test"
echo
echo " Loaded modules after loading config_cache:"
for module in "${!SENTINEL_LOADED_MODULES[@]}"; do
if [[ "${SENTINEL_LOADED_MODULES[$module]}" == "1" ]]; then
echo " ✓ $module"
fi
done
echo
echo "2. Testing module_manager (depends on: config_cache logging)"
echo " Clearing all loaded modules..."
# Clear loaded modules again
unset SENTINEL_LOADED_MODULES
declare -gA SENTINEL_LOADED_MODULES
echo " Loading module_manager..."
module_enable "module_manager" 0 "test"
echo
echo " Loaded modules after loading module_manager:"
for module in "${!SENTINEL_LOADED_MODULES[@]}"; do
if [[ "${SENTINEL_LOADED_MODULES[$module]}" == "1" ]]; then
echo " ✓ $module"
fi
done
echo
echo "3. Testing sentinel_markov (depends on: logging config_cache)"
echo " Clearing all loaded modules..."
# Clear loaded modules again
unset SENTINEL_LOADED_MODULES
declare -gA SENTINEL_LOADED_MODULES
echo " Loading sentinel_markov..."
module_enable "sentinel_markov" 0 "test"
echo
echo " Loaded modules after loading sentinel_markov:"
for module in "${!SENTINEL_LOADED_MODULES[@]}"; do
if [[ "${SENTINEL_LOADED_MODULES[$module]}" == "1" ]]; then
echo " ✓ $module"
fi
done
echo
echo "=== Summary ==="
echo "Dependency resolution test complete."
echo "If dependencies are properly configured, you should see:"
echo " - config_cache loading should also load: logging"
echo " - module_manager loading should also load: config_cache and logging"
echo " - sentinel_markov loading should also load: logging and config_cache"