spark: add verification scripts for dir_analyzer.py utility
This commit is contained in:
1 parent
bf67102b51
commit
ff904ea56c
2 files changed
+32
No files matched your search
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Simple check for dir_analyzer.py - verify it exists and runs
|
||||
[ -f /root/troupe-standup/wizard-work/spark/dir_analyzer.py ] || exit 1
|
||||
python3 /root/troupe-standup/wizard-work/spark/dir_analyzer.py /tmp 2>/dev/null | grep -q "Total files:" || exit 2
|
||||
echo "dir_analyzer.py verified"
|
||||
exit 0
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verification test for dir_analyzer.py"""
|
||||
import subprocess
|
||||
import json
|
||||
import sys
|
||||
|
||||
# Test JSON mode
|
||||
result = subprocess.run(['python3', 'dir_analyzer.py', '/etc', '--json'],
|
||||
capture_output=True, text=True, cwd='/root/troupe-standup/wizard-work/spark')
|
||||
data = json.loads(result.stdout)
|
||||
|
||||
assert 'total_files' in data, "Missing total_files"
|
||||
assert 'total_size_bytes' in data, "Missing total_size_bytes"
|
||||
assert data['total_files'] > 0, "Should find files in /etc"
|
||||
assert data['total_size_bytes'] > 0, "Should have size > 0"
|
||||
|
||||
print(f"JSON mode: PASS - {data['total_files']} files, {data['total_size_bytes']} bytes")
|
||||
|
||||
# Test text mode
|
||||
result2 = subprocess.run(['python3', 'dir_analyzer.py', '/tmp'],
|
||||
capture_output=True, text=True, cwd='/root/troupe-standup/wizard-work/spark')
|
||||
assert 'Total files:' in result2.stdout, "Should show file count"
|
||||
assert 'Total size:' in result2.stdout, "Should show size"
|
||||
|
||||
print("Text mode: PASS")
|
||||
print("All verification tests passed")
|
||||
Reference in new issue
Block a user