Skip to content

The agent that grows with you

test(agent): eviction tests assert the entry is dropped, not that the client is closed

teknium1fad77444e0f2
diff --git a/tests/agent/test_auxiliary_client.py b/tests/agent/test_auxiliary_client.py
index 7e5c7d9b353..396859da5e6 100644
--- a/tests/agent/test_auxiliary_client.py
+++ b/tests/agent/test_auxiliary_client.py
@@ -2889,10 +2889,12 @@ class TestAuxiliaryAuthRefreshRetry:
from agent.auxiliary_client import _refresh_provider_credentials
assert _refresh_provider_credentials("anthropic", failed_api_key="expired-token") is True
+ import agent.auxiliary_client as aux
+ assert cache_key not in aux._client_cache # evicted, not closed (in-flight users)
mock_refresh_oauth.assert_called_once_with("refresh-token", use_json=False)
mock_write.assert_called_once_with("fresh-token", "refresh-token-2", 9999999999999)
- stale_client.close.assert_called_once()
+ stale_client.close.assert_not_called()
def test_refresh_provider_credentials_remints_vertex_token_and_evicts_cache(self):
"""Vertex tokens live ~1h; on a long-running gateway the cached
@@ -2917,9 +2919,11 @@ class TestAuxiliaryAuthRefreshRetry:
from agent.auxiliary_client import _refresh_provider_credentials
assert _refresh_provider_credentials("vertex") is True
+ import agent.auxiliary_client as aux
+ assert cache_key not in aux._client_cache # evicted, not closed (in-flight users)
mock_get_config.assert_called_once()
- stale_client.close.assert_called_once()
+ stale_client.close.assert_not_called()
def test_refresh_provider_credentials_vertex_returns_false_when_unminted(self):
"""No usable token/base_url (e.g. ADC and the service-account file