Skip to content

Commit 2a0637e

Browse files
authored
Fixed intermittent timing issue in test_expiration by extending sleep duration (#692)
Signed-off-by: Manav Gupta <[email protected]>
1 parent 35a90f3 commit 2a0637e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/unit/mcpgateway/cache/test_resource_cache.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# Standard
1212
import asyncio
13+
import logging
1314
import time
1415

1516
# Third-Party
@@ -40,11 +41,11 @@ def test_expiration(cache):
4041
"""Test that cache entry expires after TTL."""
4142
# Use a more generous sleep duration to account for timing variability
4243
cache.set("foo", "bar")
43-
44+
4445
# Sleep for 1.5 seconds (50% longer than TTL) to ensure expiration
4546
# This accounts for system load, clock precision, and floating point issues
4647
time.sleep(1.5)
47-
48+
4849
# Entry should definitely be expired now
4950
assert cache.get("foo") is None
5051

0 commit comments

Comments
 (0)