You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The project includes automated tests for testing the Ingress Controller in a Kubernetes cluster. The tests are written
4
-
in Python3 and use the pytest framework.
3
+
The project includes automated tests for testing the NGINX Ingress Controller in a Kubernetes cluster. The tests are written in Python 3 and use the pytest framework with additional tools like Playwright for browser automation.
5
4
6
-
Below you will find the instructions on how to run the tests against a Minikube and kind clusters. However, you are not
7
-
limited to those options and can use other types of Kubernetes clusters. See the [Configuring the
8
-
Tests](#configuring-the-tests) section to find out about various configuration options.
5
+
This documentation covers how to run tests against Minikube and Kind clusters, though the tests can be run against any Kubernetes cluster. See the [Configuring the Tests](#configuring-the-tests) section for various configuration options.
9
6
10
7
## Running Tests in Minikube
11
8
12
9
### Prerequisites
13
10
14
-
- Minikube.
15
-
-Python3 or Docker.
11
+
-[Minikube](https://minikube.sigs.k8s.io/docs/)
12
+
-Python 3.10+ or Docker
16
13
17
14
#### Step 1 - Create a Minikube Cluster
18
15
@@ -22,39 +19,29 @@ minikube start
22
19
23
20
#### Step 2 - Run the Tests
24
21
25
-
**Note**: if you have the Ingress Controller deployed in the cluster, please uninstall it first, making sure to remove
26
-
its namespace and RBAC resources.
22
+
**Note**: If you have the Ingress Controller already deployed in the cluster, please uninstall it first, ensuring you remove its namespace and RBAC resources.
@@ -69,24 +56,25 @@ below to learn how to configure the tests including the image and the type of NG
69
56
70
57
### Prerequisites
71
58
72
-
- [Kind](https://kind.sigs.k8s.io/).
73
-
- Docker.
59
+
- [Kind](https://kind.sigs.k8s.io/)
60
+
- Docker
74
61
75
-
**Note**: all commands in steps below are executed from the ```tests``` directory
62
+
**Note**: All commands inthe steps below are executed from the `tests` directory.
76
63
77
-
List available make commands
64
+
List available make commands:
78
65
79
66
```bash
80
-
$ make
81
-
82
-
help Show available make targets
83
-
build Run build
84
-
run-tests Run tests
85
-
run-tests-in-kind Run tests in Kind
86
-
create-kind-cluster Create Kind cluster
87
-
delete-kind-cluster Delete Kind cluster
67
+
make help
88
68
```
89
69
70
+
This will show you all available targets including:
71
+
72
+
- `build` - Build the test container image
73
+
- `run-tests` - Run tests in Docker
74
+
- `run-tests-in-kind` - Run tests in Kind cluster
75
+
- `create-kind-cluster` - Create a Kind cluster
76
+
- `delete-kind-cluster` - Delete a Kind cluster
77
+
90
78
#### Step 1 - Create a Kind Cluster
91
79
92
80
```bash
@@ -95,8 +83,7 @@ make create-kind-cluster
95
83
96
84
#### Step 2 - Run the Tests
97
85
98
-
**Note**: if you have the Ingress Controller deployed in the cluster, please uninstall it first, making sure to remove
99
-
its namespace and RBAC resources.
86
+
**Note**: If you have the Ingress Controller already deployed in the cluster, please uninstall it first, ensuring you remove its namespace and RBAC resources.
100
87
101
88
Run the tests in Docker:
102
89
@@ -105,13 +92,27 @@ make build
105
92
make run-tests-in-kind
106
93
```
107
94
108
-
The tests will use the Ingress Controller for NGINX with the default *nginx/nginx-ingress:edge* image. See the section
109
-
below to learn how to configure the tests including the image and the type of NGINX -- NGINX or NGINX Plus.
95
+
The tests will use the NGINX Ingress Controller with the default `nginx/nginx-ingress:edge` image. See the [Configuring the Tests](#configuring-the-tests) section to learn how to configure different images and NGINX types (OSS vs Plus).
96
+
97
+
## Additional Make Targets
98
+
99
+
The test suite includes several additional make targets for cluster management and cleanup:
100
+
101
+
102
+
- `make create-mini-cluster` - Create a Minikube K8S cluster
103
+
- `make delete-mini-cluster` - Delete a Minikube K8S cluster
104
+
- `make run-tests-in-minikube` - Run tests in Minikube
105
+
- `make mini-image-load` - Load the image into the Minikube K8S cluster
106
+
- `make image-load` - Load the image into the Kind K8S cluster
107
+
- `make mini-image-load` - Load the image into the Minikube K8S cluster
108
+
- `make setup-venv` - Create Python virtual environment with all dependencies
- `make run-local-tests` - Run tests using local Python environment
111
+
- `make test-lint` - Run Python linting tools (isort, black)
110
112
111
113
## Configuring the Tests
112
114
113
-
The table below shows various configuration options for the tests. If you use Python3 to run the tests, use the
114
-
command-line arguments. If you use Docker, use the [Makefile](Makefile) variables.
115
+
The table below shows various configuration options for the tests. If you use Python 3 to run the tests locally, use the command-line arguments. If you use Docker, use the [Makefile](Makefile) variables.
@@ -126,20 +127,42 @@ command-line arguments. If you use Docker, use the [Makefile](Makefile) variable
126
127
|`N/A`|`KUBE_CONFIG_FOLDER`, not supported by `run-tests-in-kind` target. | A path to a folder with a kubeconfig file. |`~/.kube/`|
127
128
|`--show-ic-logs`|`SHOW_IC_LOGS`| A flag to control accumulating IC logs in stdout. |`no`|
128
129
|`--skip-fixture-teardown`|`N/A`| A flag to skip test fixture teardown for debugging. |`no`|
130
+
|`--plus-jwt`|`PLUS_JWT`| JWT token for NGINX Plus image authentication. |`""`|
129
131
|`N/A`|`PYTEST_ARGS`| Any additional pytest command-line arguments (i.e `-m "smoke"`) |`""`|
130
132
131
-
If you would like to use an IDE (such as PyCharm) to run the tests, use the [pytest.ini](pytest.ini) file to set the
132
-
command-line arguments.
133
+
If you would like to use an IDE (such as PyCharm) to run the tests, use the [pyproject.toml](../pyproject.toml) file to view pytest configuration and markers.
133
134
134
-
Tests are marked with custom markers. The markers allow to logically split all the tests into smaller groups. The full
135
-
list can be found in the [pytest.ini](pytest.ini) file or via command line:
135
+
Tests are marked with custom markers that allow you to logically split all tests into smaller groups. The full list can be found in the [pyproject.toml](../pyproject.toml) file or via command line:
136
136
137
137
```bash
138
-
python3 -m pytest --markers
138
+
pytest --markers
139
139
```
140
140
141
141
## Test Containers
142
142
143
143
The source code forthe tests containers usedin some tests, for example the
144
144
[transport-server-tcp-load-balance](./data/transport-server-tcp-load-balance/standard/service_deployment.yaml) is
145
145
located at [kic-test-containers](https://github.com/nginx/kic-test-containers).
146
+
147
+
## Test Structure
148
+
149
+
The test suite is organized as follows:
150
+
151
+
- `suite/` - Main test files organized by functionality
0 commit comments