-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Test Coverage Below Target
Priority: P1 - High
Estimate: 6 hours
Review Reference: REVIEW.md (P1-6)
Current State
- Overall: 52.5%
- internal/http: 51.6%
- internal/storage: 72.2%
- Target: 80%
Missing Test Scenarios
- Error paths in HTTP handlers - Many error branches untested
- Pagination edge cases - Offset/limit boundary conditions
- CIDR computation edge cases - /31, /32 prefixes
- Export functionality - CSV generation, field filtering
- Migration rollback scenarios
- Concurrent access patterns
Solution
Add comprehensive test files:
internal/http/handlers_error_test.go- Error scenarios- Pagination boundary tests
- CIDR edge case tests (/31, /32 handling)
- CSV export with various field combinations
- Concurrent pool operation tests
Example Missing Tests:
func TestPoolsHandlers_StorageErrors(t *testing.T) {
// Use mock store that returns errors
// Test each handler's error path
}
func TestBlocks_EdgeCases(t *testing.T) {
// Test /31 and /32 prefix handling
// Test huge pagination requests
// Test negative offsets
}
func TestExport_AllFormats(t *testing.T) {
// Test CSV field selection
// Test empty datasets
// Test large datasets (memory usage)
}Acceptance Criteria
- Overall coverage >= 80%
- All error paths in handlers tested
- Pagination edge cases covered
- CIDR /31 and /32 tests added
- CSV export comprehensively tested
- Concurrent access tests added
- Coverage report generated and checked in CI
Validation
make cover
# Check coverage.html - should show 80%+ overall
make test-race
# Verify no race conditions in new tests