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

pallet-scheduler: fix test #3923

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions substrate/frame/scheduler/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2285,9 +2285,18 @@ fn postponed_named_task_cannot_be_rescheduled() {

// Run to a very large block.
run_to_block(10);

// It was not executed.
assert!(logger::log().is_empty());
assert!(Preimage::is_requested(&hash));

// Preimage was not available
assert_eq!(
System::events().last().unwrap().event,
crate::Event::CallUnavailable { task: (4, 0), id: Some(name) }.into()
);

// So it should not be requested.
assert!(!Preimage::is_requested(&hash));
sandreim marked this conversation as resolved.
Show resolved Hide resolved
// Postponing removes the lookup.
assert!(!Lookup::<Test>::contains_key(name));

Expand All @@ -2307,11 +2316,12 @@ fn postponed_named_task_cannot_be_rescheduled() {
);

// Finally add the preimage.
assert_ok!(Preimage::note(call.encode().into()));
assert_ok!(Preimage::note_preimage(RuntimeOrigin::signed(0), call.encode()));

run_to_block(1000);
// It did not execute.
assert!(logger::log().is_empty());
assert!(Preimage::is_requested(&hash));
assert!(!Preimage::is_requested(&hash));

// Manually re-schedule the call by name does not work.
assert_err!(
Expand Down
Loading