Skip to content

Conversation

@jnewbery
Copy link
Contributor

@jnewbery jnewbery commented May 8, 2017

Second step towards #10082

This PR changes the individual test cases to call the BitcoinTestFramework.start_node and .stop_node methods rather than the util.py functions. This is in preparation for moving the start/stop node functionality into BitcoinTestFramework (currently the BitcoinTestFramework start/stop node methods are just wrappers for the util.py functions).

The second commit changes the names of the functions in util.py to mark them as private. This is so no test cases are added/modified to call the functions directly before the next step of #10082 is merged.

@maflcko
Copy link
Member

maflcko commented May 8, 2017

Concept ACK. Needs rebase.

@maflcko maflcko added the Tests label May 8, 2017
@jnewbery jnewbery force-pushed the test_framework_start_stop_nodes branch 2 times, most recently from 883081d to fb580db Compare May 9, 2017 13:42
@jnewbery jnewbery force-pushed the test_framework_start_stop_nodes branch from fb580db to e42627d Compare May 15, 2017 20:00
@jnewbery
Copy link
Contributor Author

rebased

jnewbery added 2 commits May 31, 2017 16:59
This commit changes the individual test scripts to call the
start_node(s) and stop_node(s) methods in BitcoinTestFramework.
This commit marks the start/stop functions in util.py as private module
functions. A future PR will remove these entirely and move the
functionality directly into the BitcoinTestFramework class, but setting them as
private in this PR will prevent anyone from accidentally calling them
before that future PR is merged.
@jnewbery jnewbery force-pushed the test_framework_start_stop_nodes branch from e42627d to a433d8a Compare May 31, 2017 21:00
@jnewbery
Copy link
Contributor Author

jnewbery commented May 31, 2017

rebased. It'd be really helpful to get this merged so we can make some progress on #10082 . This is the only disruptive changeset in that larger PR - the rest of the changes are restricted to the test_framework directory.

This PR touches a lot of files, but it should be a trivial review. It's simply changing calls from stop_node() to calls to self.stop_node() etc wrapper functions in the first commit. The second commit renames the inner functions so no-one calls them explicitly from the test cases (the inner functions will be removed entirely in a future PR).

@MarcoFalke , @TheBlueMatt , @ryanofsky , @sdaftuar, @jimmysong, @kallewoof - if I could convince any of you to review, I'd be very grateful!

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly tested ACK a433d8a

assert_raises_jsonrpc,
assert_is_hex_string,
assert_is_hash_string,
connect_nodes_bi,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change seems unrelated, maybe revert.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. not sure how that snuck in. Reverted.

############################################################
# locked wallet test
self.nodes[1].encryptwallet("test")
self.stop_node(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move these up one line so nodes[1].encrypt and pop(1) can be next to each other.

Copy link
Contributor

@jimmysong jimmysong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. testing now.

stop_node(self.nodes[0],0)
self.nodes[0]=start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.0001"])
self.stop_node(0)
self.nodes[0] = self.start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.0001"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan is to change start_node so assignment here would be unnecessary in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - that's certainly something we can do in a future PR once the BitcoinTestFramework class is responsible for tracking and stop/starting the nodes.

assert_raises_jsonrpc,
assert_is_hex_string,
assert_is_hash_string,
connect_nodes_bi,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this was added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me neither 😳. Removed

stop_node(self.nodes[2], 3)

self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that self.start_nodes would also do the assignment in the future?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless it should be possible to append nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

certainly something we can do in a future PR.

BitcoinTestFramework could include two functions - start_nodes() to start the nodes in self.nodes, and add_nodes() if you need to append nodes to that list.

connect_nodes_bi,
p2p_port,
)
p2p_port)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I personally like comma endings so adding new imports has cleaner diffs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Reverted.

@jimmysong
Copy link
Contributor

Tested, ACK a433d8a

A couple of really small nits. Excited to keep this moving!

Copy link
Contributor

@kallewoof kallewoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK a433d8a

stop_node(self.nodes[2], 3)

self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless it should be possible to append nodes.

connect_nodes_bi,
p2p_port,
)
p2p_port)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

@jnewbery
Copy link
Contributor Author

jnewbery commented Jun 1, 2017

Thanks @ryanofsky @jimmysong @kallewoof . Nits fixed in fixup commit. Will squash when this is ready for merge.

@maflcko
Copy link
Member

maflcko commented Jun 2, 2017

utACK 53f6775

@maflcko maflcko merged commit 53f6775 into bitcoin:master Jun 2, 2017
maflcko pushed a commit that referenced this pull request Jun 2, 2017
…rk start/stop node methods

53f6775 fixup: fix nits (John Newbery)
a433d8a [tests] Update start/stop node functions to be private module functions (John Newbery)
d8c218f [tests] Functional tests call self.start_node(s) and self.stop_node(s) (John Newbery)

Tree-SHA512: 9cc01584a5e57686b7e7cb1c4c5186ad8cc7eb650d6d4f27b06bdb5e249a10966705814bdfb22d9ff2d5d3326911e489bf3d22257d751a299c0b24b7f40bffb5
@jnewbery jnewbery deleted the test_framework_start_stop_nodes branch June 2, 2017 13:06
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 26, 2019
…Framework start/stop node methods

53f6775 fixup: fix nits (John Newbery)
a433d8a [tests] Update start/stop node functions to be private module functions (John Newbery)
d8c218f [tests] Functional tests call self.start_node(s) and self.stop_node(s) (John Newbery)

Tree-SHA512: 9cc01584a5e57686b7e7cb1c4c5186ad8cc7eb650d6d4f27b06bdb5e249a10966705814bdfb22d9ff2d5d3326911e489bf3d22257d751a299c0b24b7f40bffb5
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants