Skip to content

Testing and QA

joshuaaferguson edited this page Nov 15, 2025 · 1 revision

Testing & QA

Use this guide with TESTING.md, docs/SECURITY_TESTING.md, and repo-specific CONTRIBUTING guides.

Test Matrix

  • Controller (controller/): go test -v ./... -coverprofile=coverage.out validates reconcilers, webhooks, and idle logic. Aim to keep coverage at/above the current total reported by go tool cover -func.
  • API (api/): Go unit tests around handlers/middleware, plus integration tests hitting fake Kubernetes/Postgres where practical. Sensitive flows (auth, rate limiting, webhook signatures) need explicit regression tests.
  • UI (ui/): npm test -- --coverage --watchAll=false (Vitest/RTL recommended) for components, hooks, and state stores. Snapshot tests acceptable for complex MUI layouts.
  • Templates (streamspace-templates): kubectl apply --dry-run=client + --server-dry-run and lints for YAML conventions. Ensure icons and categories align with catalog metadata.
  • Plugins (streamspace-plugins): Add unit tests when logic grows beyond simple hooks. Manual verification via StreamSpace UI/CLI is required—document results in PRs.

Local Test Environment (per TESTING.md)

  1. Install Docker Desktop with Kubernetes, allocate 4+ CPUs / 8GB RAM.
  2. Enable Kubernetes, install local-path provisioner, and set the default StorageClass.
  3. Create streamspace namespace, apply CRDs (manifests/crds/), and install via Helm with test values.
  4. Use kubectl get pods -w until controller/API/UI/Postgres are running.
  5. Port-forward the UI or use ingress to exercise session workflows and UI features.

Coverage & Quality Gates

  • Run make fmt lint test locally before pushing. CI enforces formatting, linting, and tests.
  • Document manual test plans for features touching session lifecycle, security boundaries, or UI workflows (see REVIEW_SUMMARY.md template).
  • For integration features (plugins, repositories), log test evidence in PR descriptions (commands, screenshots, or API responses).

Troubleshooting

  • Use kubectl logs with -n streamspace to inspect controller/API pods and watch hibernation events.
  • Check controller/controllers/*_test.go for reference patterns when writing new reconciler tests.
  • Review TESTING.md troubleshooting section for common setup mistakes (CRDs missing, storage class misconfig, ingress/TLS issues).

Security-focused testing guidance (fuzzing, scanning, penetration testing) is captured in docs/SECURITY_TESTING.md and summarized on Security-and-Compliance.

Clone this wiki locally