From d75a33d524f6c2ad82a6c240a8597bdecf429839 Mon Sep 17 00:00:00 2001 From: Volodymyr Zotov Date: Tue, 26 Aug 2025 16:50:06 -0500 Subject: [PATCH] Add testing.md doc to describe where specific tests should be added --- docs/testing.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 docs/testing.md diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 0000000..da077be --- /dev/null +++ b/docs/testing.md @@ -0,0 +1,26 @@ +# Testing + +## Unit tests +**When**: Pure Go logic, no Kubernetes apiserver or network. +**Where**: `internal/...`, `pkg/...` +**Add files in**: `*_test.go` next to the code. +**Run**: `make test` + +## Integration tests (envtest) +**When**: Controller/reconciler behavior against a mocked kubernetes cluster. +**Where**: `internal/controller/...` +**Framework**: controller-runtime’s `envtest`. +**Run**: `make test` + +## E2E tests (kind) +**When**: Full cluster behavior (CRDs, operator image, Connect/SA flows). +**Where**: `test/e2e/...` +**Framework**: Ginkgo + `pkg/testhelper`. + +**Local prep**: +1. [Install `kind`](https://kind.sigs.k8s.io/docs/user/quick-start/#installing-with-a-package-manager) to spin up local Kubernetes cluster. +2. `export OP_CONNECT_TOKEN=` +3. `export OP_SERVICE_ACCOUNT_TOKEN=` +4. `make test-e2e` + +**Run**: `make test-e2e` \ No newline at end of file