Skip to content

Commit e9d0959

Browse files
authored
Merge pull request #1033 from libp2p/fix/kad-dht-kbucket-split-test
fix: Make test_kbucket_split_behavior more reliable
2 parents 51d1c46 + 8e9b3ac commit e9d0959

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/core/kad_dht/test_unit_routing_table.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ def mock_host(self):
257257
"""Create a mock host for testing."""
258258
host = Mock()
259259
host.get_peerstore.return_value = Mock()
260+
# Mock new_stream to raise an exception so ping fails in tests
261+
# This allows peers to be added when bucket is full
262+
host.new_stream = AsyncMock(side_effect=Exception("Mock stream error"))
260263
return host
261264

262265
@pytest.fixture

0 commit comments

Comments
 (0)