Skip to content

Commit

Permalink
XcmRecorder integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
ipapandinas committed Sep 12, 2024
1 parent ab3ec8c commit 936d410
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tests/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ pallet-proxy = { workspace = true }
pallet-session = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-utility = { workspace = true }
pallet-xcm = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-trie = { workspace = true }
xcm = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }

# astar dependencies
Expand Down
21 changes: 20 additions & 1 deletion tests/integration/src/xcm_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use xcm::{
},
VersionedLocation, VersionedXcm,
};
use xcm_executor::RecordXcm;
use xcm_fee_payment_runtime_api::dry_run::runtime_decl_for_dry_run_api::DryRunApiV1;
use xcm_fee_payment_runtime_api::fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1;

Expand Down Expand Up @@ -198,7 +199,6 @@ fn query_delivery_fees_is_ok() {
})
}

// Minimal tests to make sur DryRunAPi methods are callable in a runtime isolated environement
#[test]
fn dry_run_call_is_ok() {
new_test_ext().execute_with(|| {
Expand All @@ -213,6 +213,7 @@ fn dry_run_call_is_ok() {
})
}

// Minimal test in a runtime isolated environment to make sure `dry_run_xcm` is callable
#[test]
fn dry_run_xcm_is_ok() {
new_test_ext().execute_with(|| {
Expand All @@ -231,3 +232,21 @@ fn dry_run_xcm_is_ok() {
assert_eq!(result.forwarded_xcms.len(), 1);
})
}

#[test]
fn xcm_recorder_configuration_is_ok() {
new_test_ext().execute_with(|| {
let result = pallet_xcm::Pallet::<Runtime>::should_record();
assert!(
!result,
"XCM recorder should NOT record incoming XCMs by default."
);

pallet_xcm::Pallet::<Runtime>::set_record_xcm(true);
let result = pallet_xcm::Pallet::<Runtime>::should_record();
assert!(
result,
"XCM recorder must be ready to record incoming XCMs."
);
})
}

0 comments on commit 936d410

Please sign in to comment.