diff --git a/rs/state_machine_tests/src/lib.rs b/rs/state_machine_tests/src/lib.rs index 6578db7c5c7..87eb8cf6e70 100644 --- a/rs/state_machine_tests/src/lib.rs +++ b/rs/state_machine_tests/src/lib.rs @@ -2569,8 +2569,7 @@ impl StateMachine { /// After you import the canister, you can execute methods on it and upgrade it. /// The original directory is not modified. /// - /// The function is currently not used in code, but it is useful for local - /// testing and debugging. Do not remove it. + /// This function is useful for local testing and debugging. Do not remove it. /// /// # Panics /// @@ -2580,6 +2579,8 @@ impl StateMachine { canister_directory: P, canister_id: CanisterId, ) { + use ic_replicated_state::testing::SystemStateTesting; + let canister_directory = canister_directory.as_ref(); assert!( canister_directory.is_dir(), @@ -2632,7 +2633,7 @@ impl StateMachine { } } - let canister_state = ic_state_manager::checkpoint::load_canister_state( + let mut canister_state = ic_state_manager::checkpoint::load_canister_state( &tip_canister_layout, &canister_id, ic_types::Height::new(0), @@ -2649,7 +2650,14 @@ impl StateMachine { .0; let (h, mut state) = self.state_manager.take_tip(); + + // Repartition input schedules; Required step for migrating canisters. + canister_state + .system_state + .split_input_schedules(&canister_id, &state.canister_states); + state.put_canister_state(canister_state); + self.state_manager.commit_and_certify( state, h.increment(),