Skip to content

Commit

Permalink
Update library paths and remove requirements file (#4085)
Browse files Browse the repository at this point in the history
  • Loading branch information
vepatel committed Jul 11, 2023
1 parent 2b91262 commit 0a3b2d3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 23 deletions.
6 changes: 2 additions & 4 deletions perf-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Run the tests:
* Use local Python3 installation (advised to use pyenv/virtualenv):
```bash
$ cd perf_tests
$ pip3 install -r requirements.txt
$ pytest -v -s -m ap_perf --count=<INT> --node-ip=$(minikube ip) --users=<INT> --hatch-rate=<INT> --time=<INT>
$ pip install -r ../tests/requirements.txt --no-deps
$ pytest -v -s -m ap_perf --count=<INT> --users=<INT> --hatch-rate=<INT> --time=<INT>
```

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.
Expand All @@ -47,9 +47,7 @@ The table below shows various configuration options for the performance tests. U
| `--service` | The type of the Ingress Controller service: nodeport or loadbalancer. | `nodeport` |
| `--node-ip` | The public IP of a cluster node. Not required if you use the loadbalancer service (see --service argument). | `""` |
| `--kubeconfig` | An absolute path to a kubeconfig file. | `~/.kube/config` or the value of the `KUBECONFIG` env variable |
| `N/A` | A path to a folder with a kubeconfig file. | `~/.kube/` |
| `--show-ic-logs` | A flag to control accumulating IC logs in stdout. | `no` |
| `N/A` | Any additional pytest command-line arguments (i.e `-m "smoke"`) | `""` |
| `--count` | Number of times to repeat tests | `1` |
| `--users` | Total no. of users/locusts for response perf tests. | `10` |
| `--hatch-rate` | No. of users hatched per second. | `5` |
Expand Down
29 changes: 24 additions & 5 deletions perf-tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
import os
import sys

sys.path.insert(0, "../tests")

import pytest
from kubernetes.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION
from settings import DEFAULT_DEPLOYMENT_TYPE, DEFAULT_IC_TYPE, DEFAULT_IMAGE, DEFAULT_PULL_POLICY, DEFAULT_SERVICE
from suite.resources_utils import get_first_pod_name

sys.path.insert(0, "../tests")
from settings import (
DEFAULT_DEPLOYMENT_TYPE,
DEFAULT_IC_TYPE,
DEFAULT_IMAGE,
DEFAULT_PULL_POLICY,
DEFAULT_SERVICE,
NUM_REPLICAS,
)
from suite.utils.resources_utils import get_first_pod_name


def pytest_addoption(parser) -> None:
Expand Down Expand Up @@ -53,6 +60,12 @@ def pytest_addoption(parser) -> None:
default=DEFAULT_SERVICE,
help="The type of the Ingress Controller service: nodeport or loadbalancer.",
)
parser.addoption(
"--replicas",
action="store",
default=NUM_REPLICAS,
help="Number of replica pods for type deployment",
)
parser.addoption(
"--node-ip",
action="store",
Expand All @@ -70,6 +83,12 @@ def pytest_addoption(parser) -> None:
default="no",
help="Show IC logs in stdout on test failure",
)
parser.addoption(
"--skip-fixture-teardown",
action="store",
default="no",
help="Skips teardown of test fixtures for debugging purposes",
)
parser.addoption(
"--users",
action="store",
Expand All @@ -91,7 +110,7 @@ def pytest_addoption(parser) -> None:


# import fixtures into pytest global namespace
pytest_plugins = ["suite.fixtures"]
pytest_plugins = ["suite.fixtures.fixtures", "suite.fixtures.ic_fixtures", "suite.fixtures.custom_resource_fixtures"]


def pytest_collection_modifyitems(config, items) -> None:
Expand Down
10 changes: 0 additions & 10 deletions perf-tests/requirements.txt

This file was deleted.

7 changes: 3 additions & 4 deletions perf-tests/suite/test_ap_reload_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
import yaml
from kubernetes.client import V1ContainerPort
from settings import DEPLOYMENTS, TEST_DATA
from suite.custom_resources_utils import (
from suite.utils.ap_resources_utils import (
create_ap_logconf_from_yaml,
create_ap_policy_from_yaml,
delete_ap_logconf,
delete_ap_policy,
read_ap_crd,
)
from suite.resources_utils import (
from suite.utils.resources_utils import (
create_example_app,
create_ingress,
create_ingress_with_ap_annotations,
Expand All @@ -35,7 +34,7 @@
wait_for_event_increment,
wait_until_all_pods_are_ready,
)
from suite.yaml_utils import get_first_ingress_host_from_yaml
from suite.utils.yaml_utils import get_first_ingress_host_from_yaml

ap_policy = "dataguard-alarm"
valid_resp_addr = "Server address:"
Expand Down

0 comments on commit 0a3b2d3

Please sign in to comment.