Skip to content

Commit 477be6f

Browse files
committed
change: refresh token
1 parent 6dcd83a commit 477be6f

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

tests/model_registry/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def model_registry_pod(admin_client: DynamicClient, model_registry_namespace: st
308308
return mr_pod[0]
309309

310310

311-
@pytest.fixture(scope="module")
311+
@pytest.fixture(scope="class")
312312
def sa_namespace(request: pytest.FixtureRequest, admin_client: DynamicClient) -> Generator[Namespace, None, None]:
313313
"""
314314
Creates a namespace

tests/model_registry/rbac/test_mr_rbac_sa.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from simple_logger.logger import get_logger
55
from model_registry import ModelRegistry as ModelRegistryClient
66
from tests.model_registry.rbac.utils import build_mr_client_args
7+
from utilities.infra import create_inference_token
78
from mr_openapi.exceptions import ForbiddenException
89

910
LOGGER = get_logger(name=__name__)
@@ -57,7 +58,7 @@ def test_service_account_access_denied(
5758
@pytest.mark.usefixtures("sa_namespace", "service_account", "mr_access_role", "mr_access_role_binding")
5859
def test_service_account_access_granted(
5960
self: Self,
60-
sa_token: str,
61+
service_account,
6162
model_registry_instance_rest_endpoint: list[str],
6263
):
6364
"""
@@ -67,9 +68,12 @@ def test_service_account_access_granted(
6768
LOGGER.info(f"Targeting Model Registry REST endpoint: {model_registry_instance_rest_endpoint[0]}")
6869
LOGGER.info("Applied RBAC Role/Binding via fixtures. Expecting access GRANT.")
6970

71+
# Create a fresh token to bypass OAuth proxy cache from previous test
72+
fresh_token = create_inference_token(model_service_account=service_account)
73+
7074
try:
7175
client_args = build_mr_client_args(
72-
rest_endpoint=model_registry_instance_rest_endpoint[0], token=sa_token, author="rbac-test-granted"
76+
rest_endpoint=model_registry_instance_rest_endpoint[0], token=fresh_token, author="rbac-test-granted"
7377
)
7478
LOGGER.debug(f"Attempting client connection with args: {client_args}")
7579
mr_client_success = ModelRegistryClient(**client_args)

0 commit comments

Comments
 (0)