Skip to content

Commit b5f2088

Browse files
test: add missing timeout validation tests for pool and cluster
The timeout validation was added to all three classes but tests were only added for DqliteConnection. Now pool and cluster also have coverage for the zero-timeout ValueError. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e155e15 commit b5f2088

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/test_cluster.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ def test_from_addresses(self) -> None:
1414
client = ClusterClient.from_addresses(["localhost:9001", "localhost:9002"])
1515
assert client._timeout == 10.0
1616

17+
def test_zero_timeout_raises(self) -> None:
18+
store = MemoryNodeStore(["localhost:9001"])
19+
with pytest.raises(ValueError, match="timeout must be positive"):
20+
ClusterClient(store, timeout=0)
21+
1722
async def test_find_leader_no_nodes(self) -> None:
1823
store = MemoryNodeStore()
1924
client = ClusterClient(store)

tests/test_pool.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ def test_zero_max_size_raises(self) -> None:
2222
with pytest.raises(ValueError, match="max_size.*at least 1"):
2323
ConnectionPool(["localhost:9001"], max_size=0)
2424

25+
def test_zero_timeout_raises(self) -> None:
26+
with pytest.raises(ValueError, match="timeout must be positive"):
27+
ConnectionPool(["localhost:9001"], timeout=0)
28+
2529
def test_init(self) -> None:
2630
pool = ConnectionPool(
2731
["localhost:9001", "localhost:9002"],

0 commit comments

Comments
 (0)