aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_asmap.py
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2019-12-29 19:51:04 +0100
committerJon Atack <jon@atack.com>2020-03-04 14:24:17 +0100
commitdcaf543ba0241f9219cea70b67c7b066d4c9ca9b (patch)
tree2f5b66aa59a8c8a6fd19e00b505007dc8e692c9d /test/functional/feature_asmap.py
parentb8d0412b213df18f23bf8677ab94068c6cca9f51 (diff)
downloadbitcoin-dcaf543ba0241f9219cea70b67c7b066d4c9ca9b.tar.xz
test: add functional test for an empty, unparsable asmap
This is now testable after separating the asmap finding and parsing checks in the previous commit.
Diffstat (limited to 'test/functional/feature_asmap.py')
-rwxr-xr-xtest/functional/feature_asmap.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/functional/feature_asmap.py b/test/functional/feature_asmap.py
index 6b9d90960a..8f5a77c92d 100755
--- a/test/functional/feature_asmap.py
+++ b/test/functional/feature_asmap.py
@@ -16,8 +16,10 @@ Verify node behaviour and debug log when launching bitcoind in these cases:
5. `bitcoind -asmap` with no file specified and a missing default asmap file
-The tests are order-independent. The slowest test (missing default asmap file)
-is placed last.
+6. `bitcoind -asmap` with an empty (unparsable) default asmap file
+
+The tests are order-independent. The slowest tests (missing default asmap and
+empty asmap) are placed last.
"""
import os
@@ -78,6 +80,15 @@ class AsmapTest(BitcoinTestFramework):
msg = "Error: Could not find asmap file '\"{}\"'".format(self.default_asmap)
self.node.assert_start_raises_init_error(extra_args=['-asmap'], expected_msg=msg)
+ def test_empty_asmap(self):
+ self.log.info('Test bitcoind -asmap with empty map file')
+ self.stop_node(0)
+ with open(self.default_asmap, "w", encoding="utf-8") as f:
+ f.write("")
+ msg = "Error: Could not parse asmap file \"{}\"".format(self.default_asmap)
+ self.node.assert_start_raises_init_error(extra_args=['-asmap'], expected_msg=msg)
+ os.remove(self.default_asmap)
+
def run_test(self):
self.node = self.nodes[0]
self.datadir = os.path.join(self.node.datadir, self.chain)
@@ -89,6 +100,7 @@ class AsmapTest(BitcoinTestFramework):
self.test_asmap_with_relative_path()
self.test_default_asmap()
self.test_default_asmap_with_missing_file()
+ self.test_empty_asmap()
if __name__ == '__main__':