-
Notifications
You must be signed in to change notification settings - Fork 37.7k
qa: Use node.datadir instead of tmpdir in test framework #12076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fa283e9
to
fa72ada
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK fa72ada.
BTW, maybe this should be simpler:
foo = self.node_path(1, 'regtest', 'wallets', 'wallet.dat')
test/functional/keypool-topup.py
Outdated
self.stop_node(1) | ||
|
||
shutil.copyfile(self.tmpdir + "/node1/regtest/wallets/wallet.dat", self.tmpdir + "/wallet.bak") | ||
shutil.copyfile(datadir_regtest_1 + "/wallets/wallet.dat", datadir_regtest_1 + "/wallet.bak") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also use os.path.join
?
bbbb244
to
fad2430
Compare
6a0ae9c
to
fa3dda1
Compare
utACK fa3dda1, will check for missing changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With these suggestions, node_path
honours runtime changes to datadir
, not to mention get_datadir_path
is called once only.
@@ -213,7 +217,7 @@ def add_nodes(self, num_nodes, extra_args=None, rpchost=None, timewait=None, bin | |||
assert_equal(len(extra_args), num_nodes) | |||
assert_equal(len(binary), num_nodes) | |||
for i in range(num_nodes): | |||
self.nodes.append(TestNode(i, self.options.tmpdir, extra_args[i], rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir)) | |||
self.nodes.append(TestNode(i, self.node_path(i), extra_args[i], rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use get_datadir_path(self.options.tmpdir, i)
instead.
@@ -203,6 +204,9 @@ def run_test(self): | |||
|
|||
# Public helper methods. These can be accessed by the subclass test scripts. | |||
|
|||
def node_path(self, i, *paths): | |||
return os.path.join(get_datadir_path(self.options.tmpdir, i), *paths) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use os.path.join(node[i].datadir, *paths)
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, there are a couple of these (node[i].datadir
) that could be changed:
- assert os.path.isfile(os.path.join(self.nodes[0].datadir, "regtest", "debug.log"))
+ assert os.path.isfile(self.node_path(0, 'regtest', 'debug.log'))
concept ACK. What are the benefits of using |
Implicit path join. |
ok, let me rephrase: what are the benefits of implementing this as a method on |
@jnewbery I guess either are ok. You prefer |
fa3dda1
to
fa53143
Compare
fa5519a
to
fa31ff9
Compare
fa31ff9
to
faada8b
Compare
fa8945d
to
b5aecb2
Compare
b5aecb2
to
5c2e2a8
Compare
5c2e2a8
to
c8330d4
Compare
c8330d4 qa: Use node.datadir instead of tmpdir in test framework (MarcoFalke) Pull request description: Commit c53c983 introduced the utility function `get_datadir_path`, however not all places in the code use this util function. Using the util function everywhere makes it easier to review pull requests related to the datadir. This commit replaces datadir path creation with the `datadir` member of `TestNode`, which itself uses `get_datadir_path`. Tree-SHA512: c75707ab7149d732a6d56152a5813138a33459d3d07577b60b89f2a207c83b7663fac5f203593677c9892d1c23a5eba4bd45c5c4ababf040d720b437240fcddf
…ramework c8330d4 qa: Use node.datadir instead of tmpdir in test framework (MarcoFalke) Pull request description: Commit c53c983 introduced the utility function `get_datadir_path`, however not all places in the code use this util function. Using the util function everywhere makes it easier to review pull requests related to the datadir. This commit replaces datadir path creation with the `datadir` member of `TestNode`, which itself uses `get_datadir_path`. Tree-SHA512: c75707ab7149d732a6d56152a5813138a33459d3d07577b60b89f2a207c83b7663fac5f203593677c9892d1c23a5eba4bd45c5c4ababf040d720b437240fcddf
…ramework c8330d4 qa: Use node.datadir instead of tmpdir in test framework (MarcoFalke) Pull request description: Commit c53c983 introduced the utility function `get_datadir_path`, however not all places in the code use this util function. Using the util function everywhere makes it easier to review pull requests related to the datadir. This commit replaces datadir path creation with the `datadir` member of `TestNode`, which itself uses `get_datadir_path`. Tree-SHA512: c75707ab7149d732a6d56152a5813138a33459d3d07577b60b89f2a207c83b7663fac5f203593677c9892d1c23a5eba4bd45c5c4ababf040d720b437240fcddf
Commit c53c983 introduced the utility function
get_datadir_path
, however not all places in the code use this util function. Using the util function everywhere makes it easier to review pull requests related to the datadir.This commit replaces datadir path creation with the
datadir
member ofTestNode
, which itself usesget_datadir_path
.