Skip to content

Commit 46875f6

Browse files
committed
Address review comments for MaaS RBAC tests
1 parent 4ebe4f0 commit 46875f6

File tree

7 files changed

+243
-284
lines changed

7 files changed

+243
-284
lines changed

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,3 +782,10 @@ def gpu_count_on_cluster(nodes: list[Any]) -> int:
782782
LOGGER.debug(f"Skipping non-integer allocatable for {key} on {node.name}: {val!r}")
783783
continue
784784
return total_gpus
785+
786+
787+
@pytest.fixture(scope="session")
788+
def original_user() -> str:
789+
current_user = run_command(command=["oc", "whoami"])[1].strip()
790+
LOGGER.info(f"Original user: {current_user}")
791+
return current_user

tests/model_registry/conftest.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@
3434
from pytest_testconfig import config as py_config
3535
from model_registry.types import RegisteredModel
3636

37-
from tests.model_registry.rbac.utils import wait_for_oauth_openshift_deployment
37+
from utilities.general import wait_for_oauth_openshift_deployment
3838
from tests.model_registry.utils import (
3939
generate_namespace_name,
4040
get_rest_headers,
4141
wait_for_default_resource_cleanedup,
4242
get_byoidc_user_credentials,
4343
)
44+
4445
from utilities.general import generate_random_name, wait_for_pods_running
4546

4647
from tests.model_registry.constants import (
@@ -541,13 +542,6 @@ def api_server_url(admin_client: DynamicClient) -> str:
541542
return infrastructure.instance.status.apiServerURL
542543

543544

544-
@pytest.fixture(scope="session")
545-
def original_user() -> str:
546-
current_user = run_command(command=["oc", "whoami"])[1].strip()
547-
LOGGER.info(f"Original user: {current_user}")
548-
return current_user
549-
550-
551545
@pytest.fixture(scope="module")
552546
def created_htpasswd_secret(
553547
is_byoidc: bool, original_user: str, user_credentials_rbac: dict[str, str]

tests/model_registry/rbac/utils.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,6 @@ def assert_positive_mr_registry(
6868
LOGGER.info("Client instantiated successfully after granting permissions.")
6969

7070

71-
def wait_for_oauth_openshift_deployment() -> None:
72-
deployment_obj = Deployment(name="oauth-openshift", namespace="openshift-authentication", ensure_exists=True)
73-
74-
_log = f"Wait for {deployment_obj.name} -> Type: Progressing -> Reason:"
75-
76-
def _wait_sampler(_reason: str) -> None:
77-
sampler = TimeoutSampler(
78-
wait_timeout=240,
79-
sleep=5,
80-
func=lambda: deployment_obj.instance.status.conditions,
81-
)
82-
for sample in sampler:
83-
for _spl in sample:
84-
if _spl.type == "Progressing" and _spl.reason == _reason:
85-
return
86-
87-
for reason in ("ReplicaSetUpdated", "NewReplicaSetAvailable"):
88-
LOGGER.info(f"{_log} {reason}")
89-
_wait_sampler(_reason=reason)
90-
91-
9271
def create_role_binding(
9372
admin_client: DynamicClient,
9473
model_registry_namespace: str,

0 commit comments

Comments
 (0)