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

Integration tests (experimental runtime tests framework) #1574

Closed
wants to merge 16 commits into from

Conversation

lemunozm
Copy link
Contributor

@lemunozm lemunozm commented Sep 28, 2023

Description

Fixes #1458 #1375 #1499

This PR adds a "new way" of doing integration tests, but only when the purpose is to test the interaction between different pallets in runtimes. No node, no fudge, no 3parties, no xcm, just pallet interactions in real runtimes. Slack thread with the initial discussion.

In order to improve compilation times and testing feedback loop, I've created a new crate under runtime/tests where tests can be compiled much faster. cc @mustermeiszer

Motivation

Create a way to test end-to-end paths in a runtime context independently of the runtime used.

Example. The following parameterized test:

fn test_foo<T: Config>() {
    // Test over a T runtime configuration common to all our runtimes,
    // with some common instantiations to improve the usage:
    // Balance as u128, CurrencyId, AccountId32, ...
    
    // ...
    
    // If the test requires different choices for each runtime, you can dispatch as follows:
    match T::KIND {
        RuntimeKind::Development => ...,
        RuntimeKind::Altair => ...,
        RuntimeKind::Centrifuge => ...,
    }
}

// Inject the tests for all runtimes using the `genesis()` to setup the initial stage.
crate::test_with_all_runtimes!(genesis, test_foo);

will create the following output:

running 3 tests
test test_foo::altair ... ok
test test_foo::centrifuge ... ok
test test_foo::development ... ok

Changes and Descriptions

  • Runtime tests framework
  • Loan integration tests (with oracles and runtime changes)

@lemunozm lemunozm added I4-tests Test needs fixing or improving. P4-required Issue should be addressed labels Sep 28, 2023
@lemunozm lemunozm self-assigned this Sep 28, 2023
@lemunozm lemunozm force-pushed the loans/integration-tests branch from e941205 to 072ecd4 Compare September 28, 2023 14:34
@lemunozm
Copy link
Contributor Author

lemunozm commented Oct 6, 2023

Close in favor of: #1583

@lemunozm lemunozm closed this Oct 6, 2023
@lemunozm lemunozm changed the title Loans: integration tests (experimental runtime tests framework) Integration tests (experimental runtime tests framework) Oct 18, 2023
@lemunozm lemunozm deleted the loans/integration-tests branch October 26, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I4-tests Test needs fixing or improving. P4-required Issue should be addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loans: add integration tests
1 participant