Skip to content

Commit e2b80aa

Browse files
author
Miguel Varela Ramos
authored
Add GPU E2E tests (#1882)
1 parent a673042 commit e2b80aa

File tree

4 files changed

+44
-8
lines changed

4 files changed

+44
-8
lines changed

test/e2e/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ Using a new cluster, created for testing only and deleted afterwards:
3232
pytest test/e2e/tests -k aws --aws-config <cortex_aws_cluster_config.yaml>
3333
```
3434

35-
**Note:** For the BatchAPI tests, the `--s3-path` option should be provided with an
36-
AWS S3 bucket for testing purposes. It is more convenient however to define
37-
this bucket through an environment variable, see [configuration](#configuration).
35+
**Note:** For the BatchAPI tests, the `--s3-path` option should be provided with an AWS S3 bucket for testing purposes.
36+
It is more convenient however to define this bucket through an environment variable, see [configuration](#configuration)
37+
.
3838

3939
### GCP
4040

@@ -52,19 +52,23 @@ pytest test/e2e/tests -k gcp --gcp-config <cortex_gcp_cluster_config.yaml>
5252

5353
### All Tests
5454

55-
You can run all tests at once, however the provider specific options should be passed
56-
accordingly, or the test cases will be skipped.
55+
You can run all tests at once, however the provider specific options should be passed accordingly, or the test cases
56+
will be skipped.
5757

5858
e.g.
5959

6060
```shell
6161
pytest test/e2e/tests --aws-env <cortex_aws_env> --gcp-env <cortex_gcp_env>
6262
```
6363

64+
### Skip GPU Tests
65+
66+
It is possible to skip GPU tests by passing the `--skip-gpus` flag to the pytest command.
67+
6468
## Configuration
6569

66-
It is possible to configure the behaviour of the tests by defining
67-
environment variables or a `.env` file at the project directory.
70+
It is possible to configure the behaviour of the tests by defining environment variables or a `.env` file at the project
71+
directory.
6872

6973
```dotenv
7074
# .env file

test/e2e/tests/aws/test_realtime.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import e2e.tests
2020

2121
TEST_APIS = ["pytorch/iris-classifier", "onnx/iris-classifier", "tensorflow/iris-classifier"]
22+
TEST_APIS_GPU = ["pytorch/text-generator", "tensorflow/text-generator"]
2223

2324

2425
@pytest.mark.usefixtures("client")
@@ -27,3 +28,15 @@ def test_realtime_api(config: Dict, client: cx.Client, api: str):
2728
e2e.tests.test_realtime_api(
2829
client=client, api=api, timeout=config["global"]["realtime_deploy_timeout"]
2930
)
31+
32+
33+
@pytest.mark.usefixtures("client")
34+
@pytest.mark.parametrize("api", TEST_APIS_GPU)
35+
def test_realtime_api_gpu(config: Dict, client: cx.Client, api: str):
36+
skip_gpus = config["global"].get("skip_gpus", False)
37+
if skip_gpus:
38+
pytest.skip("--skip-gpus flag detected, skipping GPU tests")
39+
40+
e2e.tests.test_realtime_api(
41+
client=client, api=api, timeout=config["global"]["realtime_deploy_timeout"]
42+
)

test/e2e/tests/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ def pytest_addoption(parser):
4949
default=None,
5050
help="set s3 path where batch jobs results will be stored",
5151
)
52+
parser.addoption(
53+
"--skip-gpus",
54+
action="store_true",
55+
help="skip GPU tests",
56+
)
5257

5358

5459
def pytest_configure(config):
@@ -69,10 +74,11 @@ def pytest_configure(config):
6974
},
7075
"global": {
7176
"realtime_deploy_timeout": int(
72-
os.environ.get("CORTEX_TEST_REALTIME_DEPLOY_TIMEOUT", 120)
77+
os.environ.get("CORTEX_TEST_REALTIME_DEPLOY_TIMEOUT", 200)
7378
),
7479
"batch_deploy_timeout": int(os.environ.get("CORTEX_TEST_BATCH_DEPLOY_TIMEOUT", 30)),
7580
"batch_job_timeout": int(os.environ.get("CORTEX_TEST_BATCH_JOB_TIMEOUT", 200)),
81+
"skip_gpus": config.getoption("--skip-gpus"),
7682
},
7783
}
7884

test/e2e/tests/gcp/test_realtime.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import e2e.tests
2020

2121
TEST_APIS = ["pytorch/iris-classifier", "onnx/iris-classifier", "tensorflow/iris-classifier"]
22+
TEST_APIS_GPU = ["pytorch/text-generator", "tensorflow/text-generator"]
2223

2324

2425
@pytest.mark.usefixtures("client")
@@ -27,3 +28,15 @@ def test_realtime_apis(config: Dict, client: cx.Client, api: str):
2728
e2e.tests.test_realtime_api(
2829
client=client, api=api, timeout=config["global"]["realtime_deploy_timeout"]
2930
)
31+
32+
33+
@pytest.mark.usefixtures("client")
34+
@pytest.mark.parametrize("api", TEST_APIS_GPU)
35+
def test_realtime_api_gpu(config: Dict, client: cx.Client, api: str):
36+
skip_gpus = config["global"].get("skip_gpus", False)
37+
if skip_gpus:
38+
pytest.skip("--skip-gpus flag detected, skipping GPU tests")
39+
40+
e2e.tests.test_realtime_api(
41+
client=client, api=api, timeout=config["global"]["realtime_deploy_timeout"]
42+
)

0 commit comments

Comments
 (0)