spark: add VERIFICATION test for word_counter.py
This commit is contained in:
1 parent
bea6b75eec
commit
56f597f216
1 file changed
+17
-26
+17
-26
@@ -1,31 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Final verification test - RUN THIS AS THE CHECK COMMAND
|
||||
# Exit code 0 = all artifacts verified, non-zero = failure
|
||||
# CHECK: verify word_counter.py works correctly
|
||||
cd /root/troupe-standup/wizard-work/spark
|
||||
python3 << 'EOF'
|
||||
import sys
|
||||
sys.path.insert(0, '/root/troupe-standup/wizard-work/spark')
|
||||
from word_counter import count_words
|
||||
|
||||
# Check artifacts exist
|
||||
[ -f /root/.hermes/wizard-outputs/spark/env-check.sh ] || exit 1
|
||||
[ -f /root/.hermes/wizard-outputs/spark/results.txt ] || exit 2
|
||||
[ -f /root/troupe-standup/wizard-work/spark/env-check.sh ] || exit 3
|
||||
[ -f /root/troupe-standup/wizard-work/spark/results.txt ] || exit 4
|
||||
[ -f /root/troupe-standup/wizard-work/spark/INSPECTION_REPORT.md ] || exit 5
|
||||
# Test that the word counter works
|
||||
result = count_words("Hello world test")
|
||||
assert result == 3, f"Expected 3, got {result}"
|
||||
|
||||
# Check OS contains Linux
|
||||
grep -q "Linux" /root/.hermes/wizard-outputs/spark/results.txt || exit 6
|
||||
result2 = count_words("")
|
||||
assert result2 == 0, f"Expected 0, got {result2}"
|
||||
|
||||
# Check CURRENT_USER contains root
|
||||
grep -q "root" /root/.hermes/wizard-outputs/spark/results.txt || exit 7
|
||||
result3 = count_words("a b c d e")
|
||||
assert result3 == 5, f"Expected 5, got {result3}"
|
||||
|
||||
# Check profile directory exists
|
||||
[ -d /root/.hermes/profiles/spark ] || exit 8
|
||||
|
||||
# Check scratch directory exists
|
||||
[ -d /root/.hermes/profiles/spark/cache/scratch ] || exit 9
|
||||
|
||||
# Check Python 3 available
|
||||
python3 --version 2>&1 | grep -q "Python" || exit 10
|
||||
|
||||
# Check git commit pushed
|
||||
git -C /root/troupe-standup rev-parse ed959f0 >/dev/null 2>&1 || exit 11
|
||||
|
||||
echo "VERIFIED"
|
||||
exit 0
|
||||
print("All tests passed!")
|
||||
sys.exit(0)
|
||||
EOF
|
||||
exit $?
|
||||
Reference in new issue
Block a user