Skip to content

Commit 52432ed

Browse files
committed
fix: implement change from PR #339
Signed-off-by: lugi0 <lgiorgi@redhat.com>
1 parent f628a8d commit 52432ed

2 files changed

Lines changed: 11 additions & 21 deletions

File tree

tests/model_registry/conftest.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,22 +213,16 @@ def model_registry_instance_service(
213213

214214
@pytest.fixture(scope="class")
215215
def model_registry_instance_rest_endpoint(
216-
request: FixtureRequest,
216+
model_registry_instance_service: Service,
217217
) -> str:
218218
"""
219219
Get the REST endpoint for the model registry instance.
220220
Args:
221-
request: The pytest request object containing the service_fixture parameter
221+
model_registry_instance_service: The service for the model registry instance
222222
Returns:
223223
str: The REST endpoint for the model registry instance
224224
"""
225-
# Get the service fixture name from the request
226-
service_fixture = getattr(request, "param", {}).get("service_fixture", "model_registry_instance_service")
227-
228-
# Get the service from the fixture
229-
service = request.getfixturevalue(argname=service_fixture)
230-
231-
return get_endpoint_from_mr_service(svc=service, protocol=Protocols.REST)
225+
return get_endpoint_from_mr_service(svc=model_registry_instance_service, protocol=Protocols.REST)
232226

233227

234228
@pytest.fixture(scope="class")

tests/model_registry/rbac/test_mr_rbac_sa.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
@pytest.mark.parametrize(
15-
"updated_dsc_component_state_scope_class, model_registry_instance_rest_endpoint",
15+
"updated_dsc_component_state_scope_class, is_model_registry_oauth",
1616
[
1717
pytest.param(
1818
{
@@ -23,8 +23,8 @@
2323
},
2424
}
2525
},
26-
{"service_fixture": "model_registry_instance_service"},
27-
id="standard_endpoint",
26+
{"use_oauth_proxy": False},
27+
id="servicemesh",
2828
),
2929
pytest.param(
3030
{
@@ -35,14 +35,14 @@
3535
},
3636
}
3737
},
38-
{"service_fixture": "model_registry_instance_oauth_service"},
39-
id="oauth_endpoint",
38+
{"use_oauth_proxy": True},
39+
id="oauth",
4040
),
4141
],
4242
indirect=True,
4343
scope="class",
4444
)
45-
@pytest.mark.usefixtures("updated_dsc_component_state_scope_class")
45+
@pytest.mark.usefixtures("updated_dsc_component_state_scope_class", "is_model_registry_oauth")
4646
class TestModelRegistryRBAC:
4747
"""
4848
Tests RBAC for Model Registry REST endpoint using ServiceAccount tokens.
@@ -63,9 +63,7 @@ def test_service_account_access_denied(
6363
"""
6464
LOGGER.info("--- Starting RBAC Test: Access Denied ---")
6565
LOGGER.info(f"Targeting Model Registry REST endpoint: {model_registry_instance_rest_endpoint}")
66-
LOGGER.info(
67-
f"Using {'OAuth' if request.node.callspec.id == 'oauth_endpoint' else 'standard'} client configuration"
68-
)
66+
LOGGER.info(f"Using {'OAuth' if request.node.callspec.id == 'oauth' else 'servicemesh'} client configuration")
6967
LOGGER.info("Expecting initial access DENIAL (403 Forbidden)")
7068

7169
client_args = build_mr_client_args(
@@ -98,9 +96,7 @@ def test_service_account_access_granted(
9896
"""
9997
LOGGER.info("--- Starting RBAC Test: Access Granted ---")
10098
LOGGER.info(f"Targeting Model Registry REST endpoint: {model_registry_instance_rest_endpoint}")
101-
LOGGER.info(
102-
f"Using {'OAuth' if request.node.callspec.id == 'oauth_endpoint' else 'standard'} client configuration"
103-
)
99+
LOGGER.info(f"Using {'OAuth' if request.node.callspec.id == 'oauth' else 'servicemesh'} client configuration")
104100
LOGGER.info("Applied RBAC Role/Binding via fixtures. Expecting access GRANT.")
105101

106102
try:

0 commit comments

Comments
 (0)