aboutsummaryrefslogtreecommitdiff
path: root/test/functional/disconnect_ban.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-08-16 18:17:34 +0200
committerMarcoFalke <falke.marco@gmail.com>2017-10-03 18:29:48 +0200
commit5398f205e3ba1f7542deeba420f9e198bcb635f5 (patch)
treec6192e754c839184b61de07d113924ef1cf8acf3 /test/functional/disconnect_ban.py
parent1d80d1e319b41e5187d5949b3c22c35df182ba3c (diff)
downloadbitcoin-5398f205e3ba1f7542deeba420f9e198bcb635f5.tar.xz
qa: Move wait_until to util
Github-Pull: #11068 Rebased-From: 08ce33f8e95efa81b37ddc6b3350462c61bbfd51
Diffstat (limited to 'test/functional/disconnect_ban.py')
-rwxr-xr-xtest/functional/disconnect_ban.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/functional/disconnect_ban.py b/test/functional/disconnect_ban.py
index 89b68aeb25..19723226d3 100755
--- a/test/functional/disconnect_ban.py
+++ b/test/functional/disconnect_ban.py
@@ -5,11 +5,13 @@
"""Test node disconnect and ban behavior"""
import time
-from test_framework.mininode import wait_until
from test_framework.test_framework import BitcoinTestFramework
-from test_framework.util import (assert_equal,
- assert_raises_jsonrpc,
- connect_nodes_bi)
+from test_framework.util import (
+ assert_equal,
+ assert_raises_jsonrpc,
+ connect_nodes_bi,
+ wait_until,
+)
class DisconnectBanTest(BitcoinTestFramework):
@@ -24,7 +26,7 @@ class DisconnectBanTest(BitcoinTestFramework):
self.log.info("setban: successfully ban single IP address")
assert_equal(len(self.nodes[1].getpeerinfo()), 2) # node1 should have 2 connections to node0 at this point
self.nodes[1].setban("127.0.0.1", "add")
- assert wait_until(lambda: len(self.nodes[1].getpeerinfo()) == 0, timeout=10)
+ wait_until(lambda: len(self.nodes[1].getpeerinfo()) == 0, timeout=10)
assert_equal(len(self.nodes[1].getpeerinfo()), 0) # all nodes must be disconnected at this point
assert_equal(len(self.nodes[1].listbanned()), 1)
@@ -90,7 +92,7 @@ class DisconnectBanTest(BitcoinTestFramework):
self.log.info("disconnectnode: successfully disconnect node by address")
address1 = self.nodes[0].getpeerinfo()[0]['addr']
self.nodes[0].disconnectnode(address=address1)
- assert wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 1, timeout=10)
+ wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 1, timeout=10)
assert not [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1]
self.log.info("disconnectnode: successfully reconnect node")
@@ -101,7 +103,7 @@ class DisconnectBanTest(BitcoinTestFramework):
self.log.info("disconnectnode: successfully disconnect node by node id")
id1 = self.nodes[0].getpeerinfo()[0]['id']
self.nodes[0].disconnectnode(nodeid=id1)
- assert wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 1, timeout=10)
+ wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 1, timeout=10)
assert not [node for node in self.nodes[0].getpeerinfo() if node['id'] == id1]
if __name__ == '__main__':