Merge branch 'ian-h-chamberlain-fix-test-parallel-connections'
This commit is contained in:
commit
5506af03d8
2 changed files with 13 additions and 8 deletions
|
@ -15,6 +15,7 @@ at anytime.
|
||||||
### Fixed
|
### Fixed
|
||||||
* Fixed amount of close nodes to add to list in case of extension to neighbouring k-buckets
|
* Fixed amount of close nodes to add to list in case of extension to neighbouring k-buckets
|
||||||
* Fixed external IP detection via jsonip.com (avoid detecting IPv6)
|
* Fixed external IP detection via jsonip.com (avoid detecting IPv6)
|
||||||
|
* Fixed failing ConnectionManager unit test for parallel connections
|
||||||
*
|
*
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
@ -184,7 +184,6 @@ class TestIntegrationConnectionManager(unittest.TestCase):
|
||||||
self.assertEqual(0, self.TEST_PEER.success_count)
|
self.assertEqual(0, self.TEST_PEER.success_count)
|
||||||
self.assertEqual(1, self.TEST_PEER.down_count)
|
self.assertEqual(1, self.TEST_PEER.down_count)
|
||||||
|
|
||||||
@unittest.SkipTest
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_parallel_connections(self):
|
def test_parallel_connections(self):
|
||||||
# Test to see that we make two new connections at a manage call,
|
# Test to see that we make two new connections at a manage call,
|
||||||
|
@ -197,16 +196,21 @@ class TestIntegrationConnectionManager(unittest.TestCase):
|
||||||
self.assertEqual(2, self.connection_manager.num_peer_connections())
|
self.assertEqual(2, self.connection_manager.num_peer_connections())
|
||||||
self.assertIn(self.TEST_PEER, self.connection_manager._peer_connections)
|
self.assertIn(self.TEST_PEER, self.connection_manager._peer_connections)
|
||||||
self.assertIn(test_peer2, self.connection_manager._peer_connections)
|
self.assertIn(test_peer2, self.connection_manager._peer_connections)
|
||||||
connection_made = yield self.connection_manager._peer_connections[self.TEST_PEER].\
|
|
||||||
|
deferred_conn_made_peer1 = self.connection_manager._peer_connections[self.TEST_PEER].\
|
||||||
factory.connection_was_made_deferred
|
factory.connection_was_made_deferred
|
||||||
self.assertFalse(connection_made)
|
deferred_conn_made_peer1.addCallback(lambda conn_made: self.assertFalse(conn_made))
|
||||||
self.assertEqual(1, self.connection_manager.num_peer_connections())
|
|
||||||
|
deferred_conn_made_peer2 = self.connection_manager._peer_connections[test_peer2].\
|
||||||
|
factory.connection_was_made_deferred
|
||||||
|
deferred_conn_made_peer2.addCallback(lambda conn_made: self.assertFalse(conn_made))
|
||||||
|
|
||||||
|
yield deferred_conn_made_peer1
|
||||||
|
yield deferred_conn_made_peer2
|
||||||
|
|
||||||
|
self.assertEqual(0, self.connection_manager.num_peer_connections())
|
||||||
self.assertEqual(0, self.TEST_PEER.success_count)
|
self.assertEqual(0, self.TEST_PEER.success_count)
|
||||||
self.assertEqual(1, self.TEST_PEER.down_count)
|
self.assertEqual(1, self.TEST_PEER.down_count)
|
||||||
connection_made = yield self.connection_manager._peer_connections[test_peer2].\
|
|
||||||
factory.connection_was_made_deferred
|
|
||||||
self.assertFalse(connection_made)
|
|
||||||
self.assertEqual(0, self.connection_manager.num_peer_connections())
|
|
||||||
self.assertEqual(0, test_peer2.success_count)
|
self.assertEqual(0, test_peer2.success_count)
|
||||||
self.assertEqual(1, test_peer2.down_count)
|
self.assertEqual(1, test_peer2.down_count)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue