-
Notifications
You must be signed in to change notification settings - Fork 276
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
[refactor] #2238: Add peer builder for tests #2304
Conversation
Codecov Report
@@ Coverage Diff @@
## iroha2-dev #2304 +/- ##
==============================================
- Coverage 65.50% 65.38% -0.12%
==============================================
Files 133 133
Lines 24697 24801 +104
==============================================
+ Hits 16177 16216 +39
- Misses 8520 8585 +65
Continue to review full report at Codecov.
|
@Arjentix seems you know the context so can you please review it? Would be great if you leave some feedback on the |
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.
Pretty the same I was thinking about!
@@ -16,22 +16,22 @@ use super::Configuration; | |||
fn restarted_peer_should_have_the_same_asset_amount() -> Result<()> { | |||
let temp_dir = Arc::new(TempDir::new()?); | |||
|
|||
let mut configuration = Configuration::test(); | |||
let mut peer = <TestPeer>::new()?; | |||
configuration.sumeragi.trusted_peers.peers = std::iter::once(peer.id.clone()).collect(); |
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.
Why this was removed?
client/benches/torii.rs
Outdated
.expect("genesis creation failed") | ||
.expect("genesis created"); |
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.
That's strange... Looks like it should be two different expectations but the message is pretty the same...
acc0305
to
94f5732
Compare
cca42bc
to
24ad0a4
Compare
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.
docs ok
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.
When all tests will pass, I'll approve
Signed-off-by: Vladimir Pesterev <pesterev@pm.me>
Description of the Change
This replaces nested methods which creates
Peer
withPeerBuilder
structure (Builder pattern).Issue
Resolves #2238
Benefits
Makes creating a test environment more flexible and convenient.
Possible Drawbacks
Idk may increase test run time.
Alternate Designs [optional]
Make
Peer
structure a builder itself. But in that design, will need to keep parameters (genesis
,configuration
,instruction_validator
,query_validator
,temp_dir
) inside thePeer
structure to start the peer's task - it will makesPeer
structure a huge.