Skip to content

Commit f98cf80

Browse files
committed
feat: add upstream and odh support
1 parent 25786e7 commit f98cf80

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

conftest.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from typing import Optional, Any
2020
from pytest_testconfig import config as py_config
2121

22-
from utilities.constants import KServeDeploymentType
22+
from utilities.constants import Distributions, KServeDeploymentType
2323
from utilities.logger import separator, setup_logging
2424

2525

@@ -160,7 +160,32 @@ def _add_upgrade_test(_item: Item, _upgrade_deployment_modes: list[str]) -> bool
160160
if config_upgrade_deployment_modes := config.getoption(name="upgrade_deployment_modes"):
161161
upgrade_deployment_modes = config_upgrade_deployment_modes.split(",")
162162

163+
# Check if odh or upstream marker was passed from invocation command
164+
skip_upstream = True
165+
skip_odh = True
166+
167+
if user_markers_index := next(
168+
(index for index, elem in enumerate(config.invocation_params.args) if elem == "-m"),
169+
None,
170+
):
171+
user_markers = config.invocation_params.args[user_markers_index + 1]
172+
if Distributions.ODH in user_markers:
173+
skip_odh = False
174+
175+
if Distributions.UPSTREAM in user_markers:
176+
skip_upstream = False
177+
163178
for item in items:
179+
# Filter out `upstream` and `odh` tests if were not explicitly requested
180+
if Distributions.UPSTREAM in item.keywords and skip_upstream:
181+
items.remove(item)
182+
continue
183+
184+
if Distributions.ODH in item.keywords and skip_odh:
185+
items.remove(item)
186+
continue
187+
188+
# Upgrade tests filtering
164189
if "pre_upgrade" in item.keywords and _add_upgrade_test(
165190
_item=item, _upgrade_deployment_modes=upgrade_deployment_modes
166191
):

docs/DEVELOPER_GUIDE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ Check [pytest.ini](../pytest.ini) for available markers; additional markers can
143143
You should NOT group unrelated tests in one class (because it is misleading the reader).
144144

145145

146+
## Markers
147+
Do not forget to add the relevant marker(s) to your test(s)
148+
Check [pytest.ini](../pytest.ini) for available markers; additional markers can always be added when needed.
149+
For features which are only supported in upstream, add the `upstream` marker. Tests that are marked as `upstream` will be skipped by default.
150+
For features which are only supported in ODH (`midstream`, add the `odh` marker. Tests that are marked as `odh` will be skipped by default.
151+
152+
146153
## Check the code
147154
### pre-commit
148155

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ markers =
77
polarion: Store polarion test ID
88
jira: Store jira bug ID
99

10+
# Distributions
11+
upstream: Mark tests as ones suitable to run only upstream.
12+
odh: Mark tests as ones suitable to run in ODH deployment (AKA `midstream`).
13+
1014
# CI
1115
smoke: Mark tests as smoke tests; covers core functionality of the product. Aims to ensure that the build is stable enough for further testing.
1216
sanity: Mark tests as sanity tests. Aims to verify that specific functionality is working as expected.

utilities/constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ class RunTimeConfig:
253253
IMAGE = "quay.io/opendatahub/openvino_model_server@sha256:564664371d3a21b9e732a5c1b4b40bacad714a5144c0a9aaf675baec4a04b148" # noqa: E501
254254

255255

256+
class Distributions:
257+
UPSTREAM: str = "upstream"
258+
ODH: str = "odh"
259+
260+
256261
MODEL_REGISTRY: str = "model-registry"
257262
MODELMESH_SERVING: str = "modelmesh-serving"
258263
ISTIO_CA_BUNDLE_FILENAME: str = "istio_knative.crt"

0 commit comments

Comments
 (0)