Skip to content

Add local integration testing infrastructure (envtest + kind) #51

@ian-flores

Description

@ian-flores

Problem

We currently only have unit tests. To test controller behavior against a real Kubernetes API, we deploy to an internal staging cluster. This is slow and risky for iterative development.

Proposed Solution

Implement a two-tier local integration testing strategy:

Tier 1: envtest (fast, API-only)

  • Purpose: Test controller reconciliation logic against a real K8s API server (no kubelet)
  • Speed: Seconds
  • What it tests: Controllers create correct K8s resources (Deployments, Services, ConfigMaps, Secrets) when CRs are applied
  • Note: Scaffolding exists in internal/controller/core/suite_test.go but is currently skipped

Tier 2: kind cluster (realistic, full stack)

  • Purpose: Test full product deployment with real containers
  • Speed: Minutes
  • What it tests: Products actually start, health checks pass, ingress works
  • Includes: Deploy controller to kind, apply Site CR, verify pods come up healthy

Scope

  • Enable envtest suite - Remove Skip(), fix binary path issues, write initial controller reconciliation tests
  • Add kind test target - make test-kind that spins up cluster, deploys operator, runs e2e tests
  • CI integration - GitHub Actions workflow that runs both tiers
  • Developer docs - How to run locally, prerequisites (Docker, kind)

Success Criteria

  1. make test runs envtest-based controller tests (fast)
  2. make test-kind runs full integration tests against kind (thorough)
  3. CI runs both on PRs
  4. Live staging cluster used only for final validation

Notes

  • envtest already partially scaffolded in suite_test.go
  • Consider using chainsaw or similar for declarative e2e tests
  • May need mock/stub external dependencies (AWS Secrets Manager, etc.)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions