feat: add local integration testing infrastructure (envtest + kind)#54
feat: add local integration testing infrastructure (envtest + kind)#54ian-flores wants to merge 1 commit intomainfrom
Conversation
- Enable envtest suite: remove Skip(), fix CRD paths, add required schemes - Add Ginkgo-based envtest tests for Site, Connect, Workbench, PackageManager CRDs - Add kind integration tests with make targets (test-kind, test-kind-full) - Add GitHub Actions workflow for CI (envtest on PRs, kind on main/nightly) - Add comprehensive testing documentation Closes #51
|
Claude finished @ian-flores's task —— View job Reviewing PR #54
Review submitted with feedback on:
|
There was a problem hiding this comment.
Review Summary
Good foundation for integration testing infrastructure. A few items to address:
Test Code Issues
internal/controller/core/site_envtest_test.go
-
Misleading test name (line 28): Test says "Should create child resources (Connect, Workbench, etc.)" but only verifies the Site CR was created - no child resources are checked. Either rename to match actual behavior or add child resource assertions (requires starting the controller).
-
Missing cleanup (line 67): The first Site test creates resources but doesn't clean them up, unlike other tests that properly delete their resources. Consider adding
DeferCleanupor explicit cleanup. -
Ineffective validation test (line 83): The "Should reject invalid Site specs" test accepts both success and failure outcomes. If validation behavior is defined, assert it; otherwise consider removing this test.
internal/controller/core/suite_test.go
- Unused helper functions (lines 104-134):
setupSiteControllerForEnvtest()andwaitFor()are defined but never called. Remove dead code or add tests that use them.
Workflow Considerations
.github/workflows/integration-tests.yml
- The
GO_VERSIONenv var (line 43) is set to'1.22'but unused sincego-version-file: go.modis used instead. Consider removing the unused env var.
Documentation
The docs/testing.md is comprehensive and well-structured.
Security Notes
- The
hack/test-kind.shscript uses appropriate practices (set -euo pipefail, proper quoting) - Helm installation uses
--waitand proper timeouts - No credential handling concerns identified
Summary
Implements a two-tier local integration testing strategy per #51:
Changes
Envtest Suite (Tier 1)
suite_test.go(removedSkip(), fixed CRD paths, added schemes)Kind Integration Tests (Tier 2)
test-kind,test-kind-full,test-integrationhack/test-kind.shfor comprehensive integration testingCI Integration
.github/workflows/integration-tests.ymlDocumentation
docs/testing.mdwith prerequisites, usage, and troubleshootingTest plan
Usage
Closes #51