Feature gate do_task in frame_system (#2707)

https://github.com/paritytech/polkadot-sdk/pull/1343/ introduced Tasks
API. This one moves `do_task` call in frame_system under the
experimental flag, till the previous one is audited.

---------

Co-authored-by: command-bot <>
This commit is contained in:
gupnik
2023-12-15 11:17:19 +05:30
committed by GitHub
parent 2cee874742
commit 11edbaf6c0
8 changed files with 32 additions and 5 deletions
+8 -3
View File
@@ -18,10 +18,13 @@
//! Tests for `pallet-example-tasks`.
#![cfg(test)]
use crate::{mock::*, Numbers, Total};
use frame_support::{assert_noop, assert_ok, traits::Task};
use crate::{mock::*, Numbers};
use frame_support::traits::Task;
use sp_runtime::BuildStorage;
#[cfg(feature = "experimental")]
use frame_support::{assert_noop, assert_ok};
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
pub fn new_test_ext() -> sp_io::TestExternalities {
@@ -89,6 +92,7 @@ fn task_index_works_at_runtime_level() {
});
}
#[cfg(feature = "experimental")]
#[test]
fn task_execution_works() {
new_test_ext().execute_with(|| {
@@ -105,11 +109,12 @@ fn task_execution_works() {
assert_ok!(System::do_task(RuntimeOrigin::signed(1), task.clone(),));
assert_eq!(Numbers::<Runtime>::get(0), Some(1));
assert_eq!(Numbers::<Runtime>::get(1), None);
assert_eq!(Total::<Runtime>::get(), (1, 4));
assert_eq!(crate::Total::<Runtime>::get(), (1, 4));
System::assert_last_event(frame_system::Event::<Runtime>::TaskCompleted { task }.into());
});
}
#[cfg(feature = "experimental")]
#[test]
fn task_execution_fails_for_invalid_task() {
new_test_ext().execute_with(|| {