github.com/nginxinc/kubernetes-ingress@v1.12.5/perf-tests/README.md (about) 1 # AP Performance (reload and response times) Tests 2 3 The project includes automated performance tests for Ingress Controller with AppProtect module in a Kubernetes cluster. The tests are written in Python3 and use the pytest framework for reload tests and locust.io for API tests. 4 5 Below you will find the instructions on how to run the tests against a Minikube cluster. However, you are not limited to Minikube and can use other types of Kubernetes clusters. See the [Configuring the Tests](#configuring-the-tests) section to find out about various configuration options. 6 7 ## Running Tests in Minikube 8 9 ### Prerequisites: 10 11 * Minikube. 12 * Python3 (in a virtualenv) 13 14 #### Step 1 - Create a Minikube Cluster 15 16 ```bash 17 $ minikube start 18 ``` 19 20 #### Step 2 - Run the Performance Tests 21 22 **Note**: if you have the Ingress Controller deployed in the cluster, please uninstall it first, making sure to remove its namespace and RBAC resources. 23 24 Run the tests: 25 26 * Use local Python3 installation (advised to use pyenv/virtualenv): 27 ```bash 28 $ cd perf_tests 29 $ pip3 install -r requirements.txt 30 $ pytest -v -s -m ap_perf --count=<INT> --node-ip=$(minikube ip) --users=<INT> --hatch-rate=<INT> --time=<INT> 31 ``` 32 33 The tests will use the Ingress Controller for NGINX with the image built from `debian-image-nap-plus`. See the section below to learn how to configure the tests including the image and the type of NGINX -- NGINX or NGINX Plus. 34 Refer the [Configuring the Tests](#configuring-the-tests) section for valid arguments. 35 36 ## Configuring the Tests 37 38 The table below shows various configuration options for the performance tests. Use command line arguments to run tests with Python3 39 40 | Command-line Argument | Description | Default | 41 | :----------------------- | :------------ | :----------------------- | 42 | `--context` | The context to use in the kubeconfig file. | `""` | 43 | `--image` | The Ingress Controller image. | `nginx/nginx-ingress:edge` | 44 | `--image-pull-policy` | The pull policy of the Ingress Controller image. | `IfNotPresent` | 45 | `--deployment-type` | The type of the IC deployment: deployment or daemon-set. | `deployment` | 46 | `--ic-type` | The type of the Ingress Controller: nginx-ingress or nginx-ingress-plus. | `nginx-ingress` | 47 | `--service` | The type of the Ingress Controller service: nodeport or loadbalancer. | `nodeport` | 48 | `--node-ip` | The public IP of a cluster node. Not required if you use the loadbalancer service (see --service argument). | `""` | 49 | `--kubeconfig` | An absolute path to a kubeconfig file. | `~/.kube/config` or the value of the `KUBECONFIG` env variable | 50 | `N/A` | A path to a folder with a kubeconfig file. | `~/.kube/` | 51 | `--show-ic-logs` | A flag to control accumulating IC logs in stdout. | `no` | 52 | `N/A` | Any additional pytest command-line arguments (i.e `-m "smoke"`) | `""` | 53 | `--count` | Number of times to repeat tests | `1` | 54 | `--users` | Total no. of users/locusts for response perf tests. | `10` | 55 | `--hatch-rate` | No. of users hatched per second. | `5` | 56 | `--time` | Duration for AP response perf tests in seconds. | `10` |