-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[test] Add aborttrescan tests #10225
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
test/functional/test_runner.py
Outdated
@@ -108,6 +108,7 @@ | |||
'rpcnamedargs.py', | |||
'listsinceblock.py', | |||
'p2p-leaktests.py', | |||
'import-abort-rescan.py', # ~17s |
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.
I think we should remove the time hint, otherwise this will become "the standard" and, with that, the "keep-it-updated" problem will follow.
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.
Hm, yeah, you're right. Removing.
Concept ACK. |
e68c168
to
28c2abf
Compare
Thanks for opening this PR to cover abortrescan. Definitely worth doing. I don't like the change you've made to I'd much prefer us to move toward having an encapsulated class for a test node, where we could have multiple rpc connections, including asynchronous rpc connections if required. I've been trying to push towards that model in #10082, but I haven't had much luck in attracting reviewers for that PR or the linked PR. I think adding random functionality into util.py is unmaintainable and is moving in the wrong direction. So concept ACK for covering this with a functional test, but please lets not add more to util.py. |
Yeah, I was wondering if I should have reversed it (i.e. ref_node takes a launch bool and start_node just proxies). As for encapsulate with multiple rpc connections, that sounds great but the functionality is, as you say, not in there. My change is minimal and works, so maybe it's an okay for now until #10082 is ready? (I'll gladly review btw. I just gotta wake up first..) Edit: Alternatively I could base this PR on top of #10082. Never done that kind of thing before though. |
28c2abf
to
296bf4a
Compare
#10082 seems like a big project (I'd love to help btw), so I am proposing a solution until that is resolved here. |
995105b
to
7e3157a
Compare
@kallewoof thanks for being so accepting of my feedback! I don't like NACKing PRs, but I really want to try to not put any additional complexity in util.py if we can help it. Have you had a look at getblocktemplate_longpoll.py ? That's doing something similar to this test where an additional asynchronous RPC thread is required. I've tried to rewrite your testcase in the same style here: https://github.com/jnewbery/bitcoin/tree/pr10225. Can you take a look and tell me what you think? I'd prefer to do it this way than adding more complexity to the mainline start_node() function. If we can get #10082 merged, then we can then look at adding an asynchronous RPC thread to the TestNode class so it's available more generally. EDIT: I've found that this test fails intermittently when I run it locally. I think perhaps the |
@jnewbery not a worry at all -- you don't have to hold back the punches with me. I am learning a lot from the feedback I get from you guys. :) Gotcha on the no-touching-util.py. I will look at getblocktemplate_longpoll and see if I can adapt. Worst case I have two options: I can drop this PR until #10082 or I can put the ref_node code into the test itself with a # TODO and we simply rip it out when it's time to replace. As for the intermittent failures, yes, I am trying to keep the time to run as low as possible and I may have put it a bit too low (upping the range in one or both of the top for loops should stabilize it, I think). |
7e3157a
to
3dc232f
Compare
@jnewbery Wow, the solution in getblocktemplate_longpoll.py was so much cleaner. I switched to that and dropped some commits. I also upped the range to hopefully address the intermittent fails you experienced. Edit: beginning to suspect problem is in fact in the abortres aborting too early. Added small sleep (7''⊱2). |
96dd997
to
6b8d2ea
Compare
Looks better, but the test is still failing more often than not for me. I ran the test 20 times (with 4 tests running in parallel):
(ignore the portseed argument - that's just a hack to allow instances of the same test to be run by the test_runner. The value of portseed is ignored). I'm not why this fails so much for me, but seems to pass for you and Travis. |
@jnewbery Is there an easy way to run the test like that? E.g. 20 times 4 in parallel? Edit: tests keep succeeding for me on a MacBook Pro. Running them on a linux machine (lubuntu) resulted in sporadic failures. Looking into it now. Edit: there are two cases where the test will fail; one is when the abortres loop sleeps right over the importprivkey time-to-finish (for |
6b8d2ea
to
761a753
Compare
761a753
to
ed60970
Compare
Edit: Actually, the failures I were seeing were related to a debug line that triggered #10265 so I am removing the WIP part. |
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
You can do this by changing the
Indeed! Is it true to say there's a tradeoff between making the test case last longer and making it more robust? If that's the case I think you should err towards making it run longer and perhaps add it as an extended script rather than a base script. |
This test is still failing intermittently for me in two different ways:
and:
This is also causing our Jenkins build machine to fail occasionally (2 times out of 30 builds) @laanwj - was this merged accidentally? There haven't been any reviews/ACKs. Can we revert it and get it reviewed before remerging? |
I think so, sorry @kallewoof, needs a new PR now. |
@kallewoof - this has been backed out by #10327 . Please open a new PR so this test can be reviewed before being merged back in. A few suggestions for making this less flakey:
|
No problem - I will do proper testing and make a new PR once done. Sorry for the trouble! |
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
ed60970 [test] Test abortrescan command. (Karl-Johan Alm) Tree-SHA512: 7f617adba65a6df8fdc4b01432992926a06c4a05da4e657653436f7716301fa5d6249d77894a097737e7fb9e118925883f2425c639058b8973680339bb8e61b6
This PR adds tests for the new
abortrescan
RPC command.A new function
ref_node
was added toutil.py
, which works likestart_node
except it never actually launches the process. This is used to get twonode
objects in python which work separately from each other, in order to make two simultaneous requests (importprivkey
andabortrescan
).