Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b362382
Create size-labeler.yml
rnetser Dec 18, 2024
3c6a875
Delete .github/workflows/size-labeler.yml
rnetser Dec 18, 2024
ccb63af
Merge branch 'main' of github.com:rnetser/opendatahub-tests
rnetser Dec 24, 2024
da0c898
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 25, 2024
94a82ec
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 26, 2024
c0c82dd
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 27, 2024
5feb447
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 30, 2024
19b9c56
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
e22ac1a
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
56ab9c5
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
5a17f03
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
ef5fe65
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
1875a44
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 1, 2025
840d442
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 2, 2025
c0d4436
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 2, 2025
ba7971a
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 3, 2025
fd73a94
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 7, 2025
bde0493
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 8, 2025
d3cd799
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 9, 2025
710befa
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 12, 2025
a662364
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 16, 2025
579c283
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 16, 2025
927cbb0
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 19, 2025
99e242e
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 22, 2025
5b83bab
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 24, 2025
4b5b007
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 27, 2025
b8e5dee
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 30, 2025
0039df0
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 30, 2025
17938d6
model mesh - add auth tests
rnetser Feb 2, 2025
44a3120
xx
rnetser Feb 2, 2025
a418727
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 3, 2025
d291c32
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 4, 2025
b6650d8
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 5, 2025
8b9f838
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 7, 2025
d53a04c
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 10, 2025
db89111
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 10, 2025
773d81a
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 12, 2025
01be6e9
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 13, 2025
71df8d5
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 16, 2025
8896bd7
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 18, 2025
0eeb162
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Feb 18, 2025
38e8a69
ci: on main upstream xxxxxxxxxxx
rnetser Feb 19, 2025
875f597
ci: reabsingxxxxxxxxxxxxxx
rnetser Feb 20, 2025
c90abf6
ci: reabsingxxxxxxxxxxxxxx
rnetser Feb 20, 2025
4a26346
ci: Merge branch 'main' of https://github.com/opendatahub-io/opendata…
rnetser Feb 24, 2025
8302ed1
ci: Merge branch 'main' of https://github.com/opendatahub-io/opendata…
rnetser Feb 25, 2025
ff1b155
ci: rebase on main
rnetser Mar 6, 2025
a04a3c4
ci: merge main branch
rnetser Mar 11, 2025
d1cb99b
ci: merge branch main
rnetser Mar 12, 2025
87faa7b
ci: merge branch main
rnetser Mar 17, 2025
dc8490d
ci: merge branch main
rnetser Mar 17, 2025
21c5b4e
feat: unpri and ns refactor
rnetser Mar 17, 2025
d979536
feat: unpri and ns refactor
rnetser Mar 17, 2025
9ee2995
fix: update imports
rnetser Mar 17, 2025
f1a142a
fix: address comment
rnetser Mar 18, 2025
33c9cbc
ci: merge main branch
rnetser Mar 18, 2025
f6c806f
ci: merge main branch
rnetser Mar 18, 2025
edd4319
ci: merge main branch
rnetser Mar 18, 2025
0230bc1
ci: merge main branch
rnetser Mar 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def model_namespace(request: FixtureRequest, admin_client: DynamicClient) -> Gen

if request.param.get("modelmesh-enabled"):
request.getfixturevalue(argname="enabled_modelmesh_in_dsc")
ns_kwargs["labels"] = {"modelmesh-enabled": "true"}
ns_kwargs["model_mesh_enabled"] = True

with create_ns(**ns_kwargs) as ns:
yield ns
Expand Down Expand Up @@ -286,3 +286,23 @@ def cluster_monitoring_config(admin_client: DynamicClient) -> Generator[ConfigMa
data=data,
) as cm:
yield cm


@pytest.fixture(scope="class")
def unprivileged_model_namespace(
request: FixtureRequest, unprivileged_client: DynamicClient
) -> Generator[Namespace, Any, Any]:
ns_kwargs = {
"name": request.param["name"],
"unprivileged_client": unprivileged_client,
}

if _annotations := request.param.get("annotations"):
ns_kwargs["ns_annotations"] = _annotations

if request.param.get("modelmesh-enabled"):
request.getfixturevalue(argname="enabled_modelmesh_in_dsc")
ns_kwargs["model_mesh_enabled"] = True

with create_ns(**ns_kwargs) as ns:
yield ns
7 changes: 0 additions & 7 deletions tests/model_serving/model_server/authentication/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from utilities.inference_utils import create_isvc
from utilities.infra import (
create_ns,
create_isvc_view_role,
get_pods_by_isvc_label,
s3_endpoint_secret,
Expand Down Expand Up @@ -329,12 +328,6 @@ def http_s3_caikit_raw_inference_service_2(


# Unprivileged user tests
@pytest.fixture(scope="class")
def unprivileged_model_namespace(
request: FixtureRequest, unprivileged_client: DynamicClient
) -> Generator[Namespace, Any, Any]:
with create_ns(unprivileged_client=unprivileged_client, name=request.param["name"]) as ns:
yield ns


@pytest.fixture(scope="class")
Expand Down
4 changes: 1 addition & 3 deletions tests/model_serving/model_server/upgrade/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def model_namespace_scope_session(
admin_client: DynamicClient,
) -> Generator[Namespace, Any, Any]:
with create_ns(
admin_client=admin_client,
name=UPGRADE_NAMESPACE,
labels={"modelmesh-enabled": "true"},
admin_client=admin_client, name=UPGRADE_NAMESPACE, model_mesh_enabled=True, add_dashboard_label=True
) as ns:
yield ns

Expand Down
46 changes: 29 additions & 17 deletions utilities/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from semver import Version
from simple_logger.logger import get_logger

from utilities.constants import Timeout
from utilities.constants import Labels, Timeout
from utilities.exceptions import FailedPodsError
from timeout_sampler import TimeoutExpiredError, TimeoutSampler
from utilities.general import create_isvc_label_selector_str, get_s3_secret_dict
Expand All @@ -44,11 +44,14 @@
@contextmanager
def create_ns(
name: str,
admin_client: Optional[DynamicClient] = None,
unprivileged_client: Optional[DynamicClient] = None,
admin_client: DynamicClient | None = None,
unprivileged_client: DynamicClient | None = None,
teardown: bool = True,
delete_timeout: int = Timeout.TIMEOUT_4MIN,
labels: Optional[dict[str, str]] = None,
labels: dict[str, str] | None = None,
ns_annotations: dict[str, str] | None = None,
model_mesh_enabled: bool = False,
add_dashboard_label: bool = False,
) -> Generator[Namespace | Project, Any, Any]:
"""
Create namespace with admin or unprivileged client.
Expand All @@ -60,30 +63,39 @@ def create_ns(
teardown (bool): should run resource teardown
delete_timeout (int): delete timeout.
labels (dict[str, str]): labels dict to set for namespace
ns_annotations (dict[str, str]): annotations dict to set for namespace
model_mesh_enabled (bool): if True, model mesh will be enabled in namespace
add_dashboard_label (bool): if True, dashboard label will be added to namespace

Yields:
Namespace | Project: namespace or project

"""
namespace_kwargs = {
"name": name,
"client": admin_client,
"teardown": teardown,
"delete_timeout": delete_timeout,
"label": labels or {},
}

if ns_annotations:
namespace_kwargs["annotations"] = ns_annotations

if model_mesh_enabled:
namespace_kwargs["label"]["modelmesh-enabled"] = "true" # type: ignore

if add_dashboard_label:
namespace_kwargs["label"][Labels.OpenDataHub.DASHBOARD] = "true" # type: ignore

if unprivileged_client:
with ProjectRequest(name=name, client=unprivileged_client, teardown=teardown):
project = Project(
name=name,
client=unprivileged_client,
teardown=teardown,
delete_timeout=delete_timeout,
)
project = Project(**namespace_kwargs)
project.wait_for_status(status=project.Status.ACTIVE, timeout=Timeout.TIMEOUT_2MIN)
yield project

else:
with Namespace(
client=admin_client,
name=name,
label=labels,
teardown=teardown,
delete_timeout=delete_timeout,
) as ns:
with Namespace(**namespace_kwargs) as ns:
ns.wait_for_status(status=Namespace.Status.ACTIVE, timeout=Timeout.TIMEOUT_2MIN)
yield ns

Expand Down
Loading