-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathverify_check_integrity.sh
More file actions
executable file
·119 lines (104 loc) · 3.65 KB
/
Copy pathverify_check_integrity.sh
File metadata and controls
executable file
·119 lines (104 loc) · 3.65 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
# Quick verification script for check_integrity command
echo "========================================"
echo "Check Integrity Command Verification"
echo "========================================"
echo ""
# Check if files exist
echo "1. Verifying file structure..."
files=(
"soroscan/ingest/management/commands/check_integrity.py"
"soroscan/ingest/tests/test_check_integrity.py"
"CHECK_INTEGRITY_GUIDE.md"
)
for file in "${files[@]}"; do
if [ -f "$file" ]; then
echo " ✓ $file exists"
else
echo " ✗ $file NOT FOUND"
fi
done
echo ""
echo "2. Checking Python syntax..."
# Check check_integrity.py
echo " Checking check_integrity.py..."
python3 -m py_compile soroscan/ingest/management/commands/check_integrity.py 2>/dev/null
if [ $? -eq 0 ]; then
echo " ✓ check_integrity.py syntax OK"
else
echo " ✗ check_integrity.py has syntax errors"
fi
# Check test_check_integrity.py
echo " Checking test_check_integrity.py..."
python3 -m py_compile soroscan/ingest/tests/test_check_integrity.py 2>/dev/null
if [ $? -eq 0 ]; then
echo " ✓ test_check_integrity.py syntax OK"
else
echo " ✗ test_check_integrity.py has syntax errors"
fi
echo ""
echo "3. Verifying imports..."
echo " Checking for ContractEvent model import..."
grep -q "from soroscan.ingest.models import ContractEvent" soroscan/ingest/management/commands/check_integrity.py
if [ $? -eq 0 ]; then
echo " ✓ ContractEvent import found"
else
echo " ✗ ContractEvent import NOT found"
fi
echo ""
echo "4. Checking command class..."
grep -q "class Command(BaseCommand):" soroscan/ingest/management/commands/check_integrity.py
if [ $? -eq 0 ]; then
echo " ✓ Command class defined"
else
echo " ✗ Command class NOT found"
fi
echo ""
echo "5. Checking test methods..."
test_count=$(grep -c "def test_" soroscan/ingest/tests/test_check_integrity.py)
echo " Found $test_count test methods"
if [ $test_count -ge 15 ]; then
echo " ✓ Sufficient test coverage ($test_count tests)"
else
echo " ✗ Insufficient test coverage ($test_count tests, expected >= 15)"
fi
echo ""
echo "6. Checking algorithm implementation..."
grep -q "_find_gaps" soroscan/ingest/management/commands/check_integrity.py
if [ $? -eq 0 ]; then
echo " ✓ Gap finding algorithm implemented"
else
echo " ✗ Gap finding algorithm NOT found"
fi
echo ""
echo "7. Checking command features..."
# Check for argument parsing
grep -q "add_argument" soroscan/ingest/management/commands/check_integrity.py
if [ $? -eq 0 ]; then
echo " ✓ Argument parsing implemented"
fi
# Check for filtering options
grep -q "contract" soroscan/ingest/management/commands/check_integrity.py && \
grep -q "event-type" soroscan/ingest/management/commands/check_integrity.py
if [ $? -eq 0 ]; then
echo " ✓ Filtering options implemented (--contract, --event-type)"
fi
# Check for output formatting
grep -q "self.style.SUCCESS" soroscan/ingest/management/commands/check_integrity.py && \
grep -q "self.style.ERROR" soroscan/ingest/management/commands/check_integrity.py
if [ $? -eq 0 ]; then
echo " ✓ Output formatting implemented (colored output)"
fi
echo ""
echo "========================================"
echo "Verification Complete!"
echo "========================================"
echo ""
echo "To run the tests (requires Django setup):"
echo " pytest soroscan/ingest/tests/test_check_integrity.py -v"
echo ""
echo "To use the command in production:"
echo " python manage.py check_integrity"
echo " python manage.py check_integrity --contract=<id>"
echo " python manage.py check_integrity --event-type=<type>"
echo " python manage.py check_integrity --verbose"