@@ -94,96 +94,89 @@ cluster with CloudNativePG pre-installed.
9494> ** Pre-submission requirement:** You must successfully run local tests before
9595> submitting a Pull Request for any extension.
9696
97+ ### The Fast Path (Automated Testing)
98+
99+ End-to-end (E2E) tests are powered by [ Chainsaw] ( https://github.com/kyverno/chainsaw ) .
100+ To simplify the workflow, use the ` e2e:test:full ` task.
101+ This single command automates environment setup, image building, and test
102+ execution:
103+
104+ ``` bash
105+ # Replace <extension> with the name of the extension (e.g., pgvector)
106+ task e2e:test:full TARGET=" <extension>"
107+ ```
108+
109+ Example for testing the ` pgvector ` extension:
110+
111+ ``` bash
112+ task e2e:test:full TARGET=" pgvector"
113+ ```
114+
115+ ** When to use the step-by-step guide:** If the automated test fails during
116+ environment setup, image building, or test execution, the step-by-step guide
117+ below provides granular control for debugging each phase independently.
118+
119+ ---
120+
121+ ## E2E step-by-step Guide
122+
97123### Initialize the environment
98124
99- The ` e2e:setup-env ` utility automates the heavy lifting. It creates a Kind
100- cluster, attaches a local Docker registry (available at ` localhost:5000 ` ), and
101- installs the CloudNativePG operator.
125+ The ` e2e:setup-env ` utility creates a Kind cluster and attaches a local Docker
126+ registry (available at ` localhost:5000 ` ).
102127
103128``` bash
104129task e2e:setup-env
105130```
106131
107132### Get access to the cluster
108133
109- Even though the cluster is running, your local ` kubectl ` doesn't know how to
110- talk to it yet. You need to "export" the credentials (the Kubeconfig).
111-
112- If you want to run ` kubectl get pods ` from your own laptop's terminal, use the
113- standard export:
134+ To interact with the cluster via ` kubectl ` from your local terminal:
114135
115136``` bash
116137task e2e:export-kubeconfig KUBECONFIG_PATH=./kubeconfig
117138export KUBECONFIG=$PWD /kubeconfig
118139```
119140
120- If you are running a test script that is also running inside a Docker container
121- on the same network, like in the case of Kind, it needs the "internal" address
122- to find the API server:
141+ To allow the test suite (running within the Docker network) to reach the API
142+ server:
123143
124144``` bash
125145task e2e:export-kubeconfig KUBECONFIG_PATH=./kubeconfig INTERNAL=true
126146```
127147
128148### Build and push the extension (` bake ` )
129149
130- Before the cluster can use your extension, you must build the image and push it
131- to the local registry (see [ "Push images for a specific project" above ] ( #6-push-images-for-a-specific-project ) ):
150+ Build the image and push it to the local registry. This command tags the image
151+ for ` localhost:5000 ` automatically.
132152
133153``` bash
134154task bake TARGET=" <extension>" PUSH=true
135155```
136156
137- This command tags the image for ` localhost:5000 ` and pushes it automatically.
138-
139- > [ !TIP]
140- > You can change the default registry through the ` registry ` environment variable
141- > (defined in the ` docker/bake.hcl ` file).
157+ > [ !NOTE]
158+ > The destination registry is controlled by the ` registry ` variable defined within the ` docker/bake.hcl ` file.
142159
143160### Prepare testing values
144161
145- We use [ Chainsaw] ( https://github.com/kyverno/chainsaw ) for declarative
146- end-to-end testing. Before running tests, you must generate specific
147- configuration values for your extension image.
148-
149- Run the following command to export these values into your extension's
150- directory:
162+ Generate configuration values so Chainsaw knows which local image to target for
163+ the E2E tests:
151164
152165``` bash
153166task e2e:generate-values TARGET=" <extension>" EXTENSION_IMAGE=" <my-local-image>"
154167```
155168
156- For example, to generate the values for the local test of the local image, you could run something similar to the following:
157-
158- ``` bash
159- # The actual name of the image might be different on your system
160- task e2e:generate-values TARGET=pgvector EXTENSION_IMAGE=" localhost:5000/pgvector-testing:0.8.1-18-trixie"
161- ```
162-
163169### Execute End-to-End tests
164170
165- The testing framework requires an internal Kubeconfig to communicate correctly
166- within the Docker network.
167-
168- First, export the internal configuration as shown above:
169-
170- ``` bash
171- task e2e:export-kubeconfig KUBECONFIG_PATH=./kubeconfig INTERNAL=true
172- ```
173-
174- Then, run the ` e2e:test ` task. This executes both the generic tests (located in
175- the global ` /test ` folder) and any extension-specific tests (located in the
176- target's ` /test ` folder):
171+ Run the test suite using the internal Kubeconfig. This executes both the
172+ generic tests (global ` /test ` folder) and extension-specific tests (target
173+ ` /test ` folder).
177174
178175``` bash
179176task e2e:test TARGET=" <extension>" KUBECONFIG_PATH=" ./kubeconfig"
180177```
181178
182- You can test the ` pgvector ` extension with:
183-
184- ``` bash
185- task e2e:test TARGET=" pgvector" KUBECONFIG_PATH=" ./kubeconfig"
186- ```
179+ ---
187180
188181### Tear down the local test environment
189182
0 commit comments