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

Improve runtime tests #1013

Closed
wants to merge 5 commits into from
Closed

Improve runtime tests #1013

wants to merge 5 commits into from

Conversation

yrong
Copy link
Contributor

@yrong yrong commented Nov 20, 2023

The added unit test focus on the flow of submit inbound message(including proof verification logic) and check MessageReceived event with specified xcm_hash as expected.

Together with the previous emulated test then we have a basic ensurance that inbound flow always work as expected without runing e2e smoke test which is a bit too slow.

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (150a785) 81.27% compared to head (3bfb3ec) 81.18%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1013      +/-   ##
==========================================
- Coverage   81.27%   81.18%   -0.09%     
==========================================
  Files          54       54              
  Lines        2238     2238              
  Branches       71       71              
==========================================
- Hits         1819     1817       -2     
- Misses        402      404       +2     
  Partials       17       17              
Flag Coverage Δ
rust 81.33% <100.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yrong yrong marked this pull request as ready for review November 20, 2023 07:57
Copy link
Collaborator

@vgeddes vgeddes left a comment

Choose a reason for hiding this comment

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

I like the goals of the PR, however, I think the implementation introduces a big problem - tight coupling between the runtime benchmark code and the runtime test code. In other words, the modularity & composability of the codebase has been compromised.

The main symptom is that the runtime tests now depend on the runtime-benchmarks feature, which is not good.

This problem can be solved by some of the following approaches:

  1. Adding a runtime-tests feature to the inbound-queue crate
  2. Move the fixture data to pallets/inbound-queue/src/fixtures.rs, and conditionally declare it as a module using #[cfg(any(feature = "runtime-tests", feature = "runtime-benchmarks))]
  3. Conditionally compile Config::Helper also using #[cfg(any(feature = "runtime-tests", feature = "runtime-benchmarks))]

@yrong yrong marked this pull request as draft November 21, 2023 13:46
@yrong yrong force-pushed the ron/improve-tests-2 branch from 09adbfa to 3bfb3ec Compare December 13, 2023 07:35
@yrong yrong marked this pull request as ready for review December 13, 2023 08:00
@yrong yrong closed this Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants