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

Refactor connection handler unit tests to adapt with new API #441

Merged
merged 2 commits into from
Feb 17, 2023

Conversation

Farhad-Shabani
Copy link
Member

@Farhad-Shabani Farhad-Shabani commented Feb 17, 2023

Closes: #440

Remark

  • Reusable components are kept inside the core::ics03_connection::handler. If we decide to apply such a writing test approach for the rest of the parts, it should be moved to a higher level inside core::handler
  • The Option<ContextError> type for the Expect::Failure should be ContextError to know what error exactly we catch in a failure scenario. But here we aimed to fulfill the refactoring purpose and this (along with other tests) should be revised with the next improvement iteration

PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@Farhad-Shabani Farhad-Shabani self-assigned this Feb 17, 2023
@codecov
Copy link

codecov bot commented Feb 17, 2023

Codecov Report

Base: 62.21% // Head: 61.14% // Decreases project coverage by -1.08% ⚠️

Coverage data is based on head (f4d373d) compared to base (0f3e03f).
Patch coverage: 93.53% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #441      +/-   ##
==========================================
- Coverage   62.21%   61.14%   -1.08%     
==========================================
  Files         131      131              
  Lines       17789    18105     +316     
==========================================
+ Hits        11068    11070       +2     
- Misses       6721     7035     +314     
Impacted Files Coverage Δ
...s/ibc/src/clients/ics07_tendermint/client_state.rs 45.42% <0.00%> (-0.22%) ⬇️
crates/ibc/src/core/handler.rs 78.26% <ø> (ø)
...bc/src/core/ics04_channel/handler/chan_open_ack.rs 84.00% <ø> (ø)
...c/src/core/ics04_channel/handler/chan_open_init.rs 80.00% <ø> (ø)
crates/ibc/src/core/ics03_connection/handler.rs 46.66% <93.33%> (-40.00%) ⬇️
...core/ics03_connection/handler/conn_open_confirm.rs 70.76% <95.34%> (-8.34%) ⬇️
...src/core/ics03_connection/handler/conn_open_ack.rs 66.66% <95.94%> (-27.90%) ⬇️
...rc/core/ics03_connection/handler/conn_open_init.rs 65.58% <96.07%> (-31.51%) ⬇️
...src/core/ics03_connection/handler/conn_open_try.rs 65.81% <96.66%> (-30.14%) ⬇️
...bc/src/core/ics03_connection/msgs/conn_open_ack.rs 95.60% <100.00%> (+0.36%) ⬆️
... and 16 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -246,8 +244,7 @@ mod tests {

let context = MockContext::default();

let msg_conn_init =
MsgConnectionOpenInit::try_from(get_dummy_raw_msg_conn_open_init(None)).unwrap();
let msg_conn_init = MsgConnectionOpenInit::new_dummy();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove all changes in the ics04_channel module? This will cause a merge conflict with #430

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There still would be conflict, because of the get_dummy_raw_msg_conn_open_*() changes and it does not take None anymore, How if we merge this PR after #430?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, in that case let's just merge as is. We need to merge this first because the last step of #430 is to remove impl Readers/Keepers for MockContext, which needs this. They won't be big conflicts anyways

@Farhad-Shabani Farhad-Shabani marked this pull request as ready for review February 17, 2023 15:18
Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for these high-quality tests! We can use them as a baseline when we implement #429

@plafer plafer merged commit dfc4838 into main Feb 17, 2023
@plafer plafer deleted the farhad/refactor-conn-tests branch February 17, 2023 15:38
Farhad-Shabani added a commit that referenced this pull request Sep 9, 2024
* Refactor connection handler unit tests

* Move generate_error_msg under Fixture struct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Refactor connection handler unit tests to adapt with new Validation/Execution API
2 participants