-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Summary
The hardware manager (internal/hardware/manager.go) currently has 0% test coverage despite being a critical 297-line component responsible for hardware discovery lifecycle management.
Background
The hardware manager coordinates:
- Periodic hardware discovery scheduling
- Performance collector integration
- Graceful startup/shutdown lifecycle
- Error handling and recovery
- Resource cleanup
Missing Test Coverage
Critical Functions (0% coverage):
NewManager- Constructor validationStart- Startup sequence and initial discoveryStop- Graceful shutdown coordinationrunPeriodicUpdates- Periodic scheduling logicupdateHardwareGraph- Core update orchestrationcollectHardwareSnapshot- Performance collector integration
Test Implementation Plan
1. Lifecycle Tests
func TestManager_Lifecycle(t *testing.T) {
// Test successful Start/Stop coordination
// Test context cancellation propagation
// Test WaitGroup synchronization
}2. Error Handling Tests
func TestManager_StartupErrors(t *testing.T) {
// Test initial discovery failures (non-fatal)
// Test performance manager integration errors
// Test resource store failures
}3. Periodic Update Tests
func TestManager_PeriodicUpdates(t *testing.T) {
// Test timer-based updates
// Test update failure recovery
// Test shutdown during update
}4. Collector Integration Tests
func TestManager_CollectorIntegration(t *testing.T) {
// Test partial collector failures
// Test collector timeout handling
// Test snapshot assembly
}Success Criteria
- Achieve >80% test coverage for manager.go
- Test all public methods and critical private methods
- Cover error paths and edge cases
- Validate proper resource cleanup
- Test concurrent access patterns
Priority
HIGH - This component manages the entire hardware discovery subsystem and lacks any test coverage.
Related
Part of hardware discovery feature testing improvements following initial implementation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels