| 1 | # End-to-end tests for konnectivity-network-proxy running in a kind cluster |
| 2 | |
| 3 | These e2e tests deploy the KNP agent and server to a local [kind](https://kind.sigs.k8s.io/) |
| 4 | cluster to verify their functionality. |
| 5 | |
| 6 | These can be run automatically using `make e2e-test`. |
| 7 | |
| 8 | ## Setup in `main_test.go` |
| 9 | |
| 10 | Before any of the actual tests are run, the `TestMain()` function |
| 11 | in `main_test.go` performs the following set up steps: |
| 12 | |
| 13 | - Spin up a new kind cluster (4 control plane and 4 worker nodes) with the node image provided by the `-kind-image` flag. |
| 14 | - Sideload the KNP agent and server images provided with `-agent-image` and `-server-image` into the cluster. |
| 15 | - Deploy the necessary RBAC and service templates for both the KNP agent and server (see `renderAndApplyManifests`). |
| 16 | |
| 17 | ## The tests |
| 18 | |
| 19 | ### `static_count_test.go` |
| 20 | |
| 21 | These tests deploy the KNP servers and agents to the previously created kind cluster. |
| 22 | After the deployments are up, the tests check that both the agent and server report |
| 23 | the correct number of connections on their metrics endpoints. |
| 24 | |
| 25 | ### `lease_count_test.go` |
| 26 | |
| 27 | Similar to `static_count_test.go`, except using the new lease-based server counting |
| 28 | system rather than passing the server count to the KNP server deployment as a CLI |
| 29 | flag. |