Skip to content

Commit 3b73567

Browse files
committed
fix: add retry logic for RBAC proxy initialization in negative test
1 parent 08ae480 commit 3b73567

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/model_registry/rbac/test_mr_rbac_sa.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,18 @@ def test_service_account_access_denied(
4545
)
4646
LOGGER.debug(f"Attempting client connection with args: {client_args}")
4747

48-
# Expect an exception related to HTTP 403
48+
# Retry for up to 2 minutes to allow kube-rbac-proxy initialization
49+
# Accept UnauthorizedException (401) as a transient error during initialization
50+
sampler = TimeoutSampler(
51+
wait_timeout=120,
52+
sleep=5,
53+
func=lambda: ModelRegistryClient(**client_args),
54+
exceptions_dict={UnauthorizedException: []},
55+
)
56+
57+
# Expect ForbiddenException (403) once kube-rbac-proxy is fully initialized
4958
with pytest.raises(ForbiddenException) as exc_info:
50-
_ = ModelRegistryClient(**client_args)
59+
_ = next(iter(sampler))
5160

5261
# Verify the status code from the caught exception
5362
http_error = exc_info.value

0 commit comments

Comments
 (0)