Skip to content

feat: add local integration testing infrastructure (envtest + kind)#54

Draft
ian-flores wants to merge 1 commit intomainfrom
issue-51-integration-tests
Draft

feat: add local integration testing infrastructure (envtest + kind)#54
ian-flores wants to merge 1 commit intomainfrom
issue-51-integration-tests

Conversation

@ian-flores
Copy link
Collaborator

Summary

Implements a two-tier local integration testing strategy per #51:

  • Tier 1: envtest - Fast API-only tests (~5 seconds)
  • Tier 2: kind cluster - Full stack tests (minutes)

Changes

Envtest Suite (Tier 1)

  • Enabled envtest in suite_test.go (removed Skip(), fixed CRD paths, added schemes)
  • Added Ginkgo-based tests for Site, Connect, Workbench, PackageManager CRDs

Kind Integration Tests (Tier 2)

  • Added Makefile targets: test-kind, test-kind-full, test-integration
  • Added hack/test-kind.sh for comprehensive integration testing

CI Integration

  • Added .github/workflows/integration-tests.yml
  • Runs envtest on every PR
  • Runs kind tests on pushes to main and nightly

Documentation

  • Added docs/testing.md with prerequisites, usage, and troubleshooting

Test plan

  • All envtest tests pass (5 specs in ~5 seconds)
  • All existing unit tests continue to pass
  • CI workflow runs successfully
  • Kind tests work in CI environment

Usage

# Run all tests (unit + envtest)
make go-test

# Run kind integration tests
make test-kind

# Run full integration suite
make test-integration

Closes #51

- 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
Copy link

claude bot commented Jan 27, 2026

Claude finished @ian-flores's task —— View job


Reviewing PR #54

  • Read review guidelines
  • Create pending review
  • Analyze code changes
  • Add inline review comments
  • Submit review

Review submitted with feedback on:

  • Test name/behavior mismatch in site_envtest_test.go
  • Missing cleanup in Site creation test
  • Ineffective validation test
  • Unused helper functions in suite_test.go
  • Unused GO_VERSION env var in workflow

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Good foundation for integration testing infrastructure. A few items to address:

Test Code Issues

internal/controller/core/site_envtest_test.go

  1. 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).

  2. 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 DeferCleanup or explicit cleanup.

  3. 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

  1. Unused helper functions (lines 104-134): setupSiteControllerForEnvtest() and waitFor() are defined but never called. Remove dead code or add tests that use them.

Workflow Considerations

.github/workflows/integration-tests.yml

  1. The GO_VERSION env var (line 43) is set to '1.22' but unused since go-version-file: go.mod is used instead. Consider removing the unused env var.

Documentation

The docs/testing.md is comprehensive and well-structured.

Security Notes

  • The hack/test-kind.sh script uses appropriate practices (set -euo pipefail, proper quoting)
  • Helm installation uses --wait and proper timeouts
  • No credential handling concerns identified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add local integration testing infrastructure (envtest + kind)

1 participant