1.4 KiB
1.4 KiB
09 — Testing
Baseline
Required before merge:
go test ./...
Test locations
| Area | Location |
|---|---|
| Collectors and replay | internal/collector/*_test.go |
| HTTP handlers and jobs | internal/server/*_test.go |
| Exporters | internal/exporter/*_test.go |
| Vendor parsers | internal/parser/vendors/<vendor>/*_test.go |
General rules
- Prefer table-driven tests
- No network access in unit tests
- Cover happy path and realistic failure/partial-data cases
- New vendor parsers need both detection and parse coverage
Mandatory coverage for dedup/filter/classify logic
Any new deduplication, filtering, or classification function must have:
- A true-positive case
- A true-negative case
- A regression case for the vendor or topology that motivated the change
This is mandatory for inventory logic, firmware filtering, and similar code paths where silent data drift is likely.
Mandatory coverage for expensive path selection
Any function that decides whether to crawl or probe an expensive path must have:
- A positive selection case
- A negative exclusion case
- A topology-level count/integration case
The goal is to catch runaway I/O regressions before they ship.
Useful focused commands
go test ./internal/exporter/...
go test ./internal/collector/...
go test ./internal/server/...
go test ./internal/parser/vendors/...