qa: Fix function names in feature_blocksdir
This commit is contained in:
parent
534b8fa560
commit
d71bedb95a
1 changed files with 12 additions and 9 deletions
|
@ -5,10 +5,12 @@
|
|||
"""Test the blocksdir option.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework, initialize_datadir
|
||||
|
||||
import shutil
|
||||
import os
|
||||
|
||||
class BlocksdirTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
|
@ -17,18 +19,19 @@ class BlocksdirTest(BitcoinTestFramework):
|
|||
|
||||
def run_test(self):
|
||||
self.stop_node(0)
|
||||
node0path = os.path.join(self.options.tmpdir, "node0")
|
||||
shutil.rmtree(node0path)
|
||||
shutil.rmtree(self.nodes[0].datadir)
|
||||
initialize_datadir(self.options.tmpdir, 0)
|
||||
self.log.info("Starting with non exiting blocksdir ...")
|
||||
self.assert_start_raises_init_error(0, ["-blocksdir="+self.options.tmpdir+ "/blocksdir"], "Specified blocks director")
|
||||
os.mkdir(self.options.tmpdir+ "/blocksdir")
|
||||
blocksdir_path = os.path.join(self.options.tmpdir, 'blocksdir')
|
||||
self.nodes[0].assert_start_raises_init_error(["-blocksdir=" + blocksdir_path], re.escape('Error: Specified blocks directory "{}" does not exist.'.format(blocksdir_path)))
|
||||
os.mkdir(blocksdir_path)
|
||||
self.log.info("Starting with exiting blocksdir ...")
|
||||
self.start_node(0, ["-blocksdir="+self.options.tmpdir+ "/blocksdir"])
|
||||
self.start_node(0, ["-blocksdir=" + blocksdir_path])
|
||||
self.log.info("mining blocks..")
|
||||
self.nodes[0].generate(10)
|
||||
assert(os.path.isfile(os.path.join(self.options.tmpdir, "blocksdir", "regtest", "blocks", "blk00000.dat")))
|
||||
assert(os.path.isdir(os.path.join(self.options.tmpdir, "node0", "regtest", "blocks", "index")))
|
||||
assert os.path.isfile(os.path.join(blocksdir_path, "regtest", "blocks", "blk00000.dat"))
|
||||
assert os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest", "blocks", "index"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
BlocksdirTest().main()
|
||||
|
|
Loading…
Reference in a new issue