Skip to content

Commit 12af74b

Browse files
author
MarcoFalke
committed
Merge #10072: Remove sources of unreliablility in extended functional tests
a4fd89f Make forknotify.py more robust (John Newbery) 1f3d78b Wait for connection to open in bip9-softforks.py (John Newbery) Tree-SHA512: de7d0002ee62ad97059b6f6c89b11f6e9901e3b4164ef6906bcd61e4ca499c277d9034784755966e5baf599869fad611b0b18f5547a384ceb5b7db3cc5bbd132
2 parents 2b477e6 + a4fd89f commit 12af74b

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

test/functional/bip9-softforks.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,14 @@ def test_BIP(self, bipName, activated_version, invalidate, invalidatePostSignatu
200200
yield TestInstance([[block, False]])
201201

202202
# Restart all
203-
self.test.block_store.close()
203+
self.test.clear_all_connections()
204204
stop_nodes(self.nodes)
205-
shutil.rmtree(self.options.tmpdir)
205+
shutil.rmtree(self.options.tmpdir + "/node0")
206206
self.setup_chain()
207207
self.setup_network()
208-
self.test.block_store = BlockStore(self.options.tmpdir)
209-
self.test.clear_all_connections()
210208
self.test.add_all_connections(self.nodes)
211-
NetworkThread().start() # Start up network handling in another thread
212-
209+
NetworkThread().start()
210+
self.test.test_nodes[0].wait_for_verack()
213211

214212
def get_tests(self):
215213
for test in itertools.chain(

test/functional/forknotify.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test the -alertnotify option."""
6+
import os
7+
import time
68

79
from test_framework.test_framework import BitcoinTestFramework
810
from test_framework.util import *
@@ -41,12 +43,19 @@ def run_test(self):
4143
self.nodes[1].generate(1)
4244
self.sync_all()
4345

46+
# Give bitcoind 10 seconds to write the alert notification
47+
timeout = 10.0
48+
while timeout > 0:
49+
if os.path.exists(self.alert_filename) and os.path.getsize(self.alert_filename):
50+
break
51+
time.sleep(0.1)
52+
timeout -= 0.1
53+
else:
54+
assert False, "-alertnotify did not warn of up-version blocks"
55+
4456
with open(self.alert_filename, 'r', encoding='utf8') as f:
4557
alert_text = f.read()
4658

47-
if len(alert_text) == 0:
48-
raise AssertionError("-alertnotify did not warn of up-version blocks")
49-
5059
# Mine more up-version blocks, should not get more alerts:
5160
self.nodes[1].generate(1)
5261
self.sync_all()

0 commit comments

Comments
 (0)