Commit 349883a
committed
feat: add concurrent, ordered check execution and introduce test suite for validator
**Added:**
- Introduced `runChecks` method to execute validation checks concurrently with
bounded parallelism, ensuring each check's output appears in submission order
- Defined `checkFunc` type for uniform check function signatures
- Added tests (`validator_test.go`) for concurrent check execution, output
ordering, result collection, and semaphore limit enforcement
**Changed:**
- Refactored all check methods in `checks.go` and their invocations to accept
an `io.Writer` parameter for flexible output (required by `runChecks`)
- Updated `addResult` to write colored status lines to a provided writer,
improving testability and output control
- Modified `DiscoverHosts` to use `addResult` with `os.Stdout`
- `RunQuickChecks` and `RunAllChecks` now delegate check execution to
`runChecks`, replacing sequential calls with concurrent, ordered execution
- Added a mutex to `Validator` to protect concurrent mutation of the report
- Improved output handling for status messages (e.g., INFO, SKIP, WARN) for
consistency and testability
**Removed:**
- Eliminated direct `fmt.Println` and `color.*` calls from check methods in
favor of writer-based output and the `printHeader` helper1 parent b865735 commit 349883a
3 files changed
Lines changed: 427 additions & 171 deletions
0 commit comments