qa: Windows fixups for functional tests

This commit is contained in:
MarcoFalke 2018-04-08 12:46:12 -04:00
parent 15c3bb4268
commit fab9095d40
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
2 changed files with 7 additions and 7 deletions

View file

@ -37,7 +37,7 @@ class NotificationsTest(BitcoinTestFramework):
# file content should equal the generated blocks hashes # file content should equal the generated blocks hashes
with open(self.block_filename, 'r') as f: with open(self.block_filename, 'r') as f:
assert_equal(sorted(blocks), sorted(f.read().splitlines())) assert_equal(sorted(blocks), sorted(l.strip() for l in f.read().splitlines()))
self.log.info("test -walletnotify") self.log.info("test -walletnotify")
# wait at most 10 seconds for expected file size before reading the content # wait at most 10 seconds for expected file size before reading the content
@ -46,7 +46,7 @@ class NotificationsTest(BitcoinTestFramework):
# file content should equal the generated transaction hashes # file content should equal the generated transaction hashes
txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count))) txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count)))
with open(self.tx_filename, 'r') as f: with open(self.tx_filename, 'r') as f:
assert_equal(sorted(txids_rpc), sorted(f.read().splitlines())) assert_equal(sorted(txids_rpc), sorted(l.strip() for l in f.read().splitlines()))
os.remove(self.tx_filename) os.remove(self.tx_filename)
self.log.info("test -walletnotify after rescan") self.log.info("test -walletnotify after rescan")
@ -59,7 +59,7 @@ class NotificationsTest(BitcoinTestFramework):
# file content should equal the generated transaction hashes # file content should equal the generated transaction hashes
txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count))) txids_rpc = list(map(lambda t: t['txid'], self.nodes[1].listtransactions("*", block_count)))
with open(self.tx_filename, 'r') as f: with open(self.tx_filename, 'r') as f:
assert_equal(sorted(txids_rpc), sorted(f.read().splitlines())) assert_equal(sorted(txids_rpc), sorted(l.strip() for l in f.read().splitlines()))
# Mine another 41 up-version blocks. -alertnotify should trigger on the 51st. # Mine another 41 up-version blocks. -alertnotify should trigger on the 51st.
self.log.info("test -alertnotify") self.log.info("test -alertnotify")

View file

@ -107,13 +107,13 @@ class MempoolPersistTest(BitcoinTestFramework):
wait_until(lambda: len(self.nodes[1].getrawmempool()) == 5) wait_until(lambda: len(self.nodes[1].getrawmempool()) == 5)
self.log.debug("Prevent bitcoind from writing mempool.dat to disk. Verify that `savemempool` fails") self.log.debug("Prevent bitcoind from writing mempool.dat to disk. Verify that `savemempool` fails")
# to test the exception we are setting bad permissions on a tmp file called mempool.dat.new # to test the exception we are creating a tmp folder called mempool.dat.new
# which is an implementation detail that could change and break this test # which is an implementation detail that could change and break this test
mempooldotnew1 = mempooldat1 + '.new' mempooldotnew1 = mempooldat1 + '.new'
with os.fdopen(os.open(mempooldotnew1, os.O_CREAT, 0o000), 'w'): os.mkdir(mempooldotnew1)
pass
assert_raises_rpc_error(-1, "Unable to dump mempool to disk", self.nodes[1].savemempool) assert_raises_rpc_error(-1, "Unable to dump mempool to disk", self.nodes[1].savemempool)
os.remove(mempooldotnew1) os.rmdir(mempooldotnew1)
if __name__ == '__main__': if __name__ == '__main__':
MempoolPersistTest().main() MempoolPersistTest().main()