5-minute guide to running tests for the Keyfactor Kubernetes Orchestrator Extension
make test-unit # Run all unit tests
make test-integration # Run integration tests
make test-coverage # Generate coverage report
make test-store-jks # Test JKS store type only
make test-store-pkcs12 # Test PKCS12 store type only
make test-cluster-setup # Show cluster setup info
make test-cluster-cleanup # Clean up test resources📖 Full documentation: MAKEFILE_TEST_TARGETS.md
cd <repo-root> # Change to the root of the k8s-orchestrator repository
dotnet test# K8SJKS tests only
dotnet test --filter "FullyQualifiedName~K8SJKS&FullyQualifiedName!~Integration"
# All PEM-based tests (K8SSecret + K8STLSSecr)
dotnet test --filter "FullyQualifiedName~K8SSecret|FullyQualifiedName~K8STLSSecr"# Option 1: Use existing cluster
export RUN_INTEGRATION_TESTS=true
dotnet test
# Option 2: Create kind cluster first
kind create cluster --name kf-integrations
kubectl config rename-context kind-kf-integrations kf-integrations
export RUN_INTEGRATION_TESTS=true
dotnet test# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults
# Install report generator (one-time)
dotnet tool install -g dotnet-reportgenerator-globaltool
# Generate HTML report
reportgenerator \
-reports:"./TestResults/**/coverage.cobertura.xml" \
-targetdir:"./TestResults/CoverageReport" \
-reporttypes:Html
# Open report (macOS)
open ./TestResults/CoverageReport/index.html- Unit Tests: 412 tests, 100% passing ✅
- Integration Tests: 120 tests, 100% passing ✅
- Total: 532 tests across 7 store types
✅ All 7 Kubernetes store types ✅ 11 key types (RSA, EC, DSA, Ed25519, Ed448) ✅ 20+ password scenarios ✅ Certificate chains ✅ Error conditions ✅ Edge cases
-
PR Quality Gate (~3 min)
- Fast build + quick unit tests
- PR size and title validation
-
Unit Tests (~10 min)
- All 412 unit tests
- .NET 8.0 and 10.0
- Code coverage
-
Integration Tests (~10 min)
- All 120 integration tests
- kind cluster (K8s v1.29)
- Framework-specific namespace isolation
- Automatic cleanup
Total: ~23 minutes for complete validation
# Trigger unit tests
gh workflow run unit-tests.yml
# Trigger integration tests with specific K8s version
gh workflow run integration-tests.yml -f kubernetes-version=v1.28.0| Document | Purpose |
|---|---|
TESTING.md |
Comprehensive testing guide (main reference) |
TESTING_QUICKSTART.md |
This file - quick commands |
.github/workflows/README.md |
GitHub Actions workflow details |
# Solution: Set environment variable
export RUN_INTEGRATION_TESTS=true
dotnet test# Solution: Verify kubeconfig exists
ls -la ~/.kube/config
# Or create kind cluster
kind create cluster --name kf-integrations# Solution: Rename your context
kubectl config rename-context <your-context> kf-integrations
# Or for kind
kubectl config rename-context kind-kf-integrations kf-integrations# Solution: Check cluster health
kubectl cluster-info
kubectl get nodes
# Cleanup stuck namespaces
kubectl delete namespace -l managed-by=keyfactor-k8s-orchestrator-testsChecklist:
- Run unit tests locally:
dotnet test - All tests passing
- No compilation errors
- (Optional) Run integration tests if changes affect K8s operations
- Review changed files
Then:
- Push branch to GitHub
- Create PR
- Wait for CI workflows (~23 min)
- Review automated test results in PR
# Run specific test class
dotnet test --filter "FullyQualifiedName~K8SJKSStoreTests"
# Run specific test method
dotnet test --filter "FullyQualifiedName~K8SJKSStoreTests.DeserializeRemoteCertificateStore_ValidJks"
# Skip slow tests
dotnet test --filter "FullyQualifiedName!~Integration"dotnet watch test# Run with maximum parallelism
dotnet test --parallel# Verbose logging
dotnet test --verbosity detailed
# Diagnostic logging
dotnet test --verbosity diagnostic-
Check the docs:
TESTING.md- Comprehensive guide.github/workflows/README.md- CI/CD workflows
-
Review test output:
dotnet test --verbosity detailed --logger "console;verbosity=detailed"
-
Create an issue: https://github.com/Keyfactor/k8s-orchestrator/issues
Ready to test? Run: dotnet test 🚀