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

CSUB-861, CSUB-883: Example for migrations and their tests #120

Draft
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

atodorov
Copy link
Contributor

@atodorov atodorov commented Dec 7, 2023

Description of proposed changes


Practical tips for PR review & merge:

  • All GitHub Actions report PASS
  • Newly added code/functions have unit tests
    • Coverage tools report all newly added lines as covered
    • The positive scenario is exercised
    • Negative scenarios are exercised, e.g. assert on all possible errors
    • Assert on events triggered if applicable
    • Assert on changes made to storage if applicable
  • Modified behavior/functions - try to make sure above test items are covered
  • Integration tests are added if applicable/needed

atodorov and others added 10 commits December 6, 2023 21:41
for consistency with other pallets and future test scripts which will be
added as part of #106.
also add rudimentary mock runtime so that unit test for migrations can
execute
Substrate/Polkadot pallet prefix migration example:
paritytech/substrate#9115

NOTE: migration weight is based on the number of items in storage
inspired by paritytech/substrate#9115

NOTE: also makes assertion in unit tests easier
which is used as part of pre_upgrade()/post_upgrade() which will be
enabled when adding the `try-runtime` feature later on.
WARNING: adds an assert inside v1::migrate() which should be removed!
@atodorov atodorov force-pushed the testing-for-improvement/CSUB-883-rename-pallet-bridge branch from c96b6ca to 88a5170 Compare December 7, 2023 16:38
@atodorov atodorov changed the title CSUB-883: Try adding data in storage with old pallet name so we can test migrations better CSUB-861, CSUB-883: Try adding data in storage with old pallet name so we can test migrations better Dec 8, 2023
@atodorov atodorov changed the title CSUB-861, CSUB-883: Try adding data in storage with old pallet name so we can test migrations better CSUB-861, CSUB-883: Example for migrations and their tests Dec 8, 2023
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.

1 participant