test(config): add comprehensive tests for config loading path
All checks were successful
check / check (push) Successful in 43s
All checks were successful
check / check (push) Successful in 43s
Add tests covering the main configuration loading path which was previously untested (only ClassifyTargets and PSL logic had tests). New test coverage: - New() constructor with default values, env overrides, and error cases - buildConfig() interval parsing with fallback to defaults on invalid input - setupViper() env prefix binding and default value registration - parseCSV() edge cases: whitespace, trailing/leading commas, empty segments - configureDebugLogging() debug mode activation - StatePath() path construction with various DataDir values - ErrNoTargets sentinel error for missing/empty targets - PORT env without DNSWATCHER_ prefix (compatibility) - Target classification into domains vs hostnames via PSL - Invalid targets (public suffixes) rejected with clear error Coverage for internal/config increased from 23% to 92.5%.
This commit is contained in:
6
internal/config/export_test.go
Normal file
6
internal/config/export_test.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package config
|
||||
|
||||
// ParseCSVForTest exports parseCSV for use in external tests.
|
||||
func ParseCSVForTest(input string) []string {
|
||||
return parseCSV(input)
|
||||
}
|
||||
Reference in New Issue
Block a user