-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Tests: Add logging in loops in p2p_sendhears.py #12849
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
Tests: Add logging in loops in p2p_sendhears.py #12849
Conversation
test/functional/p2p_sendheaders.py
Outdated
@@ -380,6 +380,8 @@ def test_nonnull_locators(self, test_node, inv_node): | |||
# PART 3. Headers announcements can stop after large reorg, and resume after | |||
# getheaders or inv from peer. | |||
for j in range(2): | |||
self.log.info("Part 3: iteration level: {}".format(j)) | |||
|
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'd slightly prefer if the comments in the loops down there were transformed into debug statements. (Where we check for i == ...
and j == ...
)
test/functional/p2p_sendheaders.py
Outdated
@@ -406,6 +408,8 @@ def test_nonnull_locators(self, test_node, inv_node): | |||
test_node.wait_for_block(new_block_hashes[-1]) | |||
|
|||
for i in range(3): | |||
self.log.debug("Part 3: i == {}".format(i)) | |||
|
|||
# Mine another block, still should get only an inv |
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.
What I meant was to transfer those comments from # ...
to self.log.debug(...
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.
Ahh sorry, I think I get what you mean now
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.
Thanks for your first contribution @ccdle12!
I'm not sure if you've dropped a commit, but this PR isn't doing what the comments suggest.
A couple of nits inline.
test/functional/p2p_sendheaders.py
Outdated
@@ -381,7 +381,7 @@ def test_nonnull_locators(self, test_node, inv_node): | |||
# getheaders or inv from peer. | |||
for j in range(2): | |||
# First try mining a reorg that can propagate with header announcement | |||
new_block_hashes = self.mine_reorg(length=7) | |||
new_block_hashes = self.mine_reorg(length=7) |
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: you've added trailing whitespace here.
test/functional/p2p_sendheaders.py
Outdated
@@ -412,11 +412,13 @@ def test_nonnull_locators(self, test_node, inv_node): | |||
test_node.check_last_announcement(inv=[tip], headers=[]) | |||
if i == 0: | |||
# Just get the data -- shouldn't cause headers announcements to resume |
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.
You can remove this comment now that you have a log saying the same thing!
Same for comments lower down.
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.
Thanks @jnewbery, I appreciate the patience for a newbie, have pushed a new commit removing the comments above the debug prints.
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.
Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits
src/test/.vscode/settings.json
Outdated
"files.associations": { | ||
"*.ipp": "cpp" | ||
} | ||
} |
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.
Unwanted file?
@@ -411,21 +411,18 @@ def test_nonnull_locators(self, test_node, inv_node): | |||
inv_node.check_last_announcement(inv=[tip], headers=[]) | |||
test_node.check_last_announcement(inv=[tip], headers=[]) | |||
if i == 0: | |||
# Just get the data -- shouldn't cause headers announcements to resume |
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.
Please remove this as well.
Changing logs to debug level and format of statment to j == ... Updating debug statements to include comments when checking for iteration level of i and j Removing comments above log prints in Part 3 Removing unwanted file Added log prints in loops in p2p_sendheaders
1709160
to
8dd547d
Compare
As it stands, this doesn't seem to be that useful. It'll print out the same log many times over as it iterates over |
utACK 8dd547d. Seems like a tiny improvement over what it was before. |
8dd547d Adding logging for loop iteration level in p2p_sendheaders.py (ccdle12) Pull request description: PR for #12453 New contributor looking at mainly the 'good first issues'. From my understanding of the issue: * Track the iteration level of loop when test fails in Travis CI Further clarification on the issue would be greatly appreciated to narrow down what can be fixed or updated. Tree-SHA512: 228524aad54c09979d990a0fc6818e13a11e1ab5e78b606b892e897bba7b1e09bf25447feb631049e45ac017eeb61fbf1c1f11e8bd5103648f976a05099ba9f9
8dd547d Adding logging for loop iteration level in p2p_sendheaders.py (ccdle12) Pull request description: PR for bitcoin#12453 New contributor looking at mainly the 'good first issues'. From my understanding of the issue: * Track the iteration level of loop when test fails in Travis CI Further clarification on the issue would be greatly appreciated to narrow down what can be fixed or updated. Tree-SHA512: 228524aad54c09979d990a0fc6818e13a11e1ab5e78b606b892e897bba7b1e09bf25447feb631049e45ac017eeb61fbf1c1f11e8bd5103648f976a05099ba9f9
8dd547d Adding logging for loop iteration level in p2p_sendheaders.py (ccdle12) Pull request description: PR for bitcoin#12453 New contributor looking at mainly the 'good first issues'. From my understanding of the issue: * Track the iteration level of loop when test fails in Travis CI Further clarification on the issue would be greatly appreciated to narrow down what can be fixed or updated. Tree-SHA512: 228524aad54c09979d990a0fc6818e13a11e1ab5e78b606b892e897bba7b1e09bf25447feb631049e45ac017eeb61fbf1c1f11e8bd5103648f976a05099ba9f9
PR for #12453
New contributor looking at mainly the 'good first issues'.
From my understanding of the issue:
Further clarification on the issue would be greatly appreciated to narrow down what can be fixed or updated.