Skip to content
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

test: Fix rpc_net.py "pong" race condition #15069

Merged
merged 1 commit into from Jan 2, 2019

Conversation

Projects
None yet
5 participants
@Empact
Copy link
Member

commented Dec 31, 2018

Prior to this change, the test fails with KeyError if pong has
a zero value at the time this is called, as getpeerinfo's
bytesrecv_per_msg result excludes zero-values.

Combined these to a single wait_until as well, which will be a bit more
forgiving re the timeout while still enforcing the same 2 seconds
overall.

https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21310881#L62

@Empact

This comment has been minimized.

Copy link
Member Author

commented Dec 31, 2018

/cc #12804

@fanquake fanquake added the Tests label Dec 31, 2018

@fanquake fanquake requested a review from jnewbery Jan 1, 2019

@MarcoFalke
Copy link
Member

left a comment

It seems weird that a key error is thrown unless the value is not 0. With the principle of least surprise, it should probably always return the full result with all values (even if they are 0)

Show resolved Hide resolved test/functional/rpc_net.py Outdated

@Empact Empact force-pushed the Empact:rpc_net-race branch Jan 1, 2019

@Empact

This comment has been minimized.

Copy link
Member Author

commented Jan 1, 2019

@MarcoFalke makes sense to me to show them, given its an rpc command / programmatic interface as well as a human one. zero-values have been excluded since introduction in ca188c6. /cc @jonasschnelli

@Empact Empact force-pushed the Empact:rpc_net-race branch Jan 1, 2019

test: Fix rpc_net.py "pong" race condition
Prior to this change, the test fails with KeyError if pong has
a zero value at the time this is called, as getpeerinfo's
bytesrecv_per_msg result excludes zero-values.

https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21310881#L62

@Empact Empact force-pushed the Empact:rpc_net-race branch to de23739 Jan 1, 2019

@Empact

This comment has been minimized.

Copy link
Member Author

commented Jan 1, 2019

On reflection, seems the before case is the more likely culprit, which calls for using get rather than regular key access, to guard against the 0 case.

@laanwj

This comment has been minimized.

Copy link
Member

commented Jan 2, 2019

utACK de23739, I prefer this solution to #15077

@MarcoFalke MarcoFalke merged commit de23739 into bitcoin:master Jan 2, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

MarcoFalke added a commit that referenced this pull request Jan 2, 2019

Merge #15069: test: Fix rpc_net.py "pong" race condition
de23739 test: Fix rpc_net.py "pong" race condition (Ben Woosley)

Pull request description:

  Prior to this change, the test fails with KeyError if pong has
  a zero value at the time this is called, as getpeerinfo's
  bytesrecv_per_msg result excludes zero-values.

  Combined these to a single wait_until as well, which will be a bit more
  forgiving re the timeout while still enforcing the same 2 seconds
  overall.

  https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21310881#L62

Tree-SHA512: dc60f95a0e139c104fd81c8a7e0c9b3c25907de26c9d4e5976ae490e8ed5db0f0c492cd0e996ef6b5eb02cae82a62d4551ed36f95601871b19472050b3247bc0

@Empact Empact deleted the Empact:rpc_net-race branch Jan 2, 2019

@jnewbery

This comment has been minimized.

Copy link
Member

commented Jan 7, 2019

utACK de23739. Thanks @Empact!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.