This repository was archived by the owner on Nov 15, 2023. It is now read-only.
client/finality-grandpa: Add regression test for observer polling network#4778
Closed
mxinden wants to merge 1 commit intoparitytech:masterfrom
Closed
client/finality-grandpa: Add regression test for observer polling network#4778mxinden wants to merge 1 commit intoparitytech:masterfrom
mxinden wants to merge 1 commit intoparitytech:masterfrom
Conversation
Ensure `Future` implementation of `ObserverWork` is polling its `NetworkBridge`. Regression test for bug introduced in d4fbb89 and fixed in 7d58cee. When polled, `NetworkBridge` forwards reputation change requests from the `GossipValidator` to the underlying `dyn Network`. This test triggers a reputation change by calling `GossipValidator::validate` with an invalid gossip message. After polling the `ObserverWork` which should poll the `NetworkBridge`, the reputation change should be forwarded to the test network.
NikVolf
reviewed
Jan 30, 2020
NikVolf
reviewed
Jan 30, 2020
| // validator to the test network. | ||
| assert!(observer.now_or_never().is_none()); | ||
|
|
||
| match tester.events.next().now_or_never() { |
Contributor
There was a problem hiding this comment.
assert_matches! would be a better choice here
bkchr
reviewed
Jan 30, 2020
|
|
||
| use futures::executor::{self, ThreadPool}; | ||
|
|
||
| #[test] |
| ); | ||
|
|
||
| // Trigger a reputation change through the gossip validator. | ||
|
|
| let mut tester = executor::block_on(tester_fut); | ||
|
|
||
| // Create an observer. | ||
|
|
| let thread_pool = ThreadPool::new().unwrap(); | ||
|
|
||
| // Create a test network. | ||
|
|
NikVolf
approved these changes
Jan 30, 2020
Contributor
NikVolf
left a comment
There was a problem hiding this comment.
lgtm, just couple of nits
Member
|
@mxinden just needs the nits fixing before it can be merged... |
Member
|
#4795 replaces this. |
gavofyork
added a commit
that referenced
this pull request
Jan 31, 2020
…work (was #4778) (#4795) * client/finality-grandpa: Add regression test observer polling network Ensure `Future` implementation of `ObserverWork` is polling its `NetworkBridge`. Regression test for bug introduced in d4fbb89 and fixed in 7d58cee. When polled, `NetworkBridge` forwards reputation change requests from the `GossipValidator` to the underlying `dyn Network`. This test triggers a reputation change by calling `GossipValidator::validate` with an invalid gossip message. After polling the `ObserverWork` which should poll the `NetworkBridge`, the reputation change should be forwarded to the test network. * Nits Co-authored-by: Max Inden <mail@max-inden.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensure
Futureimplementation ofObserverWorkis polling itsNetworkBridge. Regression test for bug introduced in d4fbb89 andfixed in 7d58cee.
When polled,
NetworkBridgeforwards reputation change requests fromthe
GossipValidatorto the underlyingdyn Network. This testtriggers a reputation change by calling
GossipValidator::validatewithan invalid gossip message. After polling the
ObserverWorkwhich shouldpoll the
NetworkBridge, the reputation change should be forwarded tothe test network.
Thanks @NikVolf for pushing for this!