File tree Expand file tree Collapse file tree
tests/model_registry/rbac Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments