-
-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Problem
The Docker provider (pkg/svc/provider/docker/) had zero test coverage despite being a critical component for local Kubernetes cluster management. According to the test coverage improvement plan (discussion #1826), pkg/svc/provider/ was identified as a high-priority area.
Solution
Created comprehensive unit tests for pkg/svc/provider/docker/provider.go with 765 lines of test code covering:
- All three label schemes (Kind, K3d, Talos)
- All Provider interface methods
- Error paths and edge cases
- Timeout handling
- 30+ test cases
Changes
Created: pkg/svc/provider/docker/provider_test.go
Coverage Impact:
| File | Lines | Functions | Before | After (Est.) |
|---|---|---|---|---|
pkg/svc/provider/docker/provider.go |
371 | 18 | 0% | ~95%+ |
Test Details
Functions Covered:
- ✅
NewProvider- constructor variations - ✅
IsAvailable- availability checks - ✅
ListNodes- all label schemes + errors - ✅
ListAllClusters- discovery + empty scenarios - ✅
NodesExist- existence + error handling - ✅
StartNodes- start ops + timeouts/failures - ✅
StopNodes- stop ops + error paths - ✅
DeleteNodes- deletion + force remove - ✅ Role extraction - all node types
- ✅ Cluster name extraction - naming patterns
- ✅ Timeout handling - context cancellation
- ✅ Constants validation - labels, timeouts
Testing Approach:
- Mock-based isolation (no Docker required)
- Table-driven tests for scenarios
- Parallel execution (
t.Parallel()) - Helper functions per label scheme
- Error path coverage
Applying Changes
Since the workflow runs in merge queue context without push permissions, the changes are available as a patch:
Branch: test/docker-provider-coverage
Commit: 7bd3e4b
To apply manually:
git fetch origin test/docker-provider-coverage
git checkout -b test/docker-provider-coverage origin/test/docker-provider-coverageOr use the patch file attached to this issue.
Validation
Run tests:
go test ./pkg/svc/provider/docker/... -v
go test ./pkg/svc/provider/docker/... -race -coverExpected:
- 30+ tests pass
- No race conditions
- ~95%+ coverage for provider.go
- Execution time < 1s (mocked)
Generate coverage:
go test -coverprofile=coverage.out ./pkg/svc/provider/docker/...
go tool cover -func=coverage.out
go tool cover -html=coverage.out -o coverage-docker.htmlImpact
This PR directly addresses the coverage improvement plan priorities and adds substantial test coverage to a previously untested critical component.
Next Steps:
- Similar test coverage for
pkg/svc/provider/hetzner/(currently 0%) - Additional provider edge cases
- Integration tests (optional, for system test suite)
Related: Daily Test Coverage Improver workflow, discussion #1826
AI generated by [Daily Test Coverage Improver](https://github.com/devantler-tech/ksail/actions/runs/{{ run_id }})
AI generated by Daily Test Coverage Improver
To add this workflow in your repository, run
gh aw add githubnext/agentics/workflows/daily-test-improver.md@1ef9dbe65e8265b57fe2ffa76098457cf3ae2b32. See usage guide.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status