Skip to content

Commit

Permalink
e2e tests README (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
l0kix2 authored Sep 5, 2024
1 parent 5e9cf64 commit 4051682
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# YTsaurus operator e2e test

## General
Source of truth of configuration and commands to run e2e tests is in the [e2e Github action](https://github.com/ytsaurus/ytsaurus-k8s-operator/blob/main/.github/workflows/subflow_run_e2e_tests.yaml#L34-L49).
The flow:
1) create k8s ([Kind](https://kind.sigs.k8s.io/)) cluster
2) build the YTsaurus operator helm chart
3) install helm chart in the Kind cluster
4) preload test YTsaurus images in kind so pods wouldn't have to download them in tests every time
5) run e2e tests with `make test-e2e`

## Development
In the development, kind cluster (with preloaded images) can be created once and reused between e2e runs. To achieve that just use `make install` to install CRD's instead of `make helm-kind-install`.

Also, it is possible to run the YTsaurus operator main process outside of k8s cluster, for example, to be able to use a debugger. To have such a configuration, a developer should set `E2E_HTTP_PROXY_INTERNAL_PORT` env variable (for example `E2E_HTTP_PROXY_INTERNAL_PORT=9000`)
and `YTOP_PROXY` env variable with matching port (for example `YTOP_PROXY=127.0.0.1:9000`) before running the e2e tests.
This way HTTP proxies of YTsaurus clusters will listen the specified port, and the YTsaurus operator code launched outside of the k8s cluster will use this port to connect to the proxy.

### Note for the MacOS users
One needs to publish ports in Kind's docker container to make the specified port available outside of Kind on MacOS.
To achieve that, the next approach can be used:
1. create Kind cluster with some ports forwarded, for example
```
# kind-config.yaml
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30000
hostPort: 9000
- containerPort: 30001
hostPort: 9001
- containerPort: 30010
hostPort: 9010
- containerPort: 30011
hostPort: 9011
- containerPort: 30020
hostPort: 9020
- containerPort: 30021
hostPort: 9021
```
```
# create_kind.sh
kind create cluster --config=kind-config.yaml
# also cert manager required for operator to work
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml
```
2. Configure env variables
```
YTOP_PROXY=127.0.0.1:9000
E2E_HTTP_PROXY_INTERNAL_PORT=30000
```

RPC proxy can be configured in a similar way, if needed `E2E_YT_RPC_PROXY=127.0.0.1:9001; E2E_RPC_PROXY_INTERNAL_PORT=30001`.

0 comments on commit 4051682

Please sign in to comment.