-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Labels
area:control-planeControl plane server functionalityControl plane server functionalitygood first issueGood for newcomersGood for newcomerstestsUnit test improvements and coverageUnit test improvements and coverage
Description
Summary
Add unit tests for the execution cleanup background service which removes stale executions.
Current State
- File:
control-plane/internal/handlers/execution_cleanup.go - Size: 242 lines
- Test coverage: None
What to Test
- Stale execution detection: Test that executions older than threshold are identified
- Batch processing: Test cleanup processes executions in batches
- Context cancellation: Test graceful shutdown when context is cancelled
- Error handling: Test behavior when storage operations fail
- Metrics tracking: Test that cleanup counts are tracked correctly
Implementation Notes
- Mock the execution store to return controlled test data
- Test different batch sizes and thresholds
- Verify logging output for cleanup operations
- Test edge cases (no stale executions, all stale executions)
Example Test Structure
func TestExecutionCleanup_CleansStaleExecutions(t *testing.T) {
// Setup mock store with stale executions
// Run cleanup
// Verify stale executions were cleaned
}
func TestExecutionCleanup_RespectsContextCancellation(t *testing.T) {
// Setup mock store
// Cancel context
// Verify cleanup stops gracefully
}Acceptance Criteria
- Create
execution_cleanup_test.go - Test coverage for stale detection logic
- Test coverage for batch processing
- Test coverage for error handling
- All tests pass with
go test ./internal/handlers/...
Files
- Source:
control-plane/internal/handlers/execution_cleanup.go - Test:
control-plane/internal/handlers/execution_cleanup_test.go(new)
Using AI to solve this issue? Read our AI-Assisted Contributions guide for testing requirements, prompt strategies, and common pitfalls to avoid.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:control-planeControl plane server functionalityControl plane server functionalitygood first issueGood for newcomersGood for newcomerstestsUnit test improvements and coverageUnit test improvements and coverage