@@ -251,7 +251,7 @@ async fn get_status(
251251 pic : & PocketIc ,
252252 sender : Principal ,
253253 args : & MigrateCanisterArgs ,
254- ) -> Vec < MigrationStatus > {
254+ ) -> Option < MigrationStatus > {
255255 let res = pic
256256 . update_call (
257257 MIGRATION_CANISTER_ID . into ( ) ,
@@ -261,7 +261,7 @@ async fn get_status(
261261 )
262262 . await
263263 . unwrap ( ) ;
264- Decode ! ( & res, Vec <MigrationStatus >) . unwrap ( )
264+ Decode ! ( & res, Option <MigrationStatus >) . unwrap ( )
265265}
266266
267267/// Advances time by a second and executes enough ticks that the state machine
@@ -593,7 +593,7 @@ async fn replay_call_after_migration() {
593593
594594 loop {
595595 let status = get_status ( & pic, sender, & args) . await ;
596- if let MigrationStatus :: Succeeded { .. } = status[ 0 ] {
596+ if let MigrationStatus :: Succeeded { .. } = status. unwrap ( ) {
597597 break ;
598598 }
599599 // We proceed in small steps here so that
@@ -1156,7 +1156,7 @@ async fn status_correct() {
11561156
11571157 let status = get_status ( & pic, sender, & args) . await ;
11581158 assert_eq ! (
1159- status[ 0 ] ,
1159+ status. unwrap ( ) ,
11601160 MigrationStatus :: InProgress {
11611161 status: "Accepted" . to_string( )
11621162 }
@@ -1165,7 +1165,7 @@ async fn status_correct() {
11651165 advance ( & pic) . await ;
11661166 let status = get_status ( & pic, sender, & args) . await ;
11671167 assert_eq ! (
1168- status[ 0 ] ,
1168+ status. unwrap ( ) ,
11691169 MigrationStatus :: InProgress {
11701170 status: "ControllersChanged" . to_string( )
11711171 }
@@ -1174,7 +1174,7 @@ async fn status_correct() {
11741174 advance ( & pic) . await ;
11751175 let status = get_status ( & pic, sender, & args) . await ;
11761176 assert_eq ! (
1177- status[ 0 ] ,
1177+ status. unwrap ( ) ,
11781178 MigrationStatus :: InProgress {
11791179 status: "StoppedAndReady" . to_string( )
11801180 }
@@ -1183,7 +1183,7 @@ async fn status_correct() {
11831183 advance ( & pic) . await ;
11841184 let status = get_status ( & pic, sender, & args) . await ;
11851185 assert_eq ! (
1186- status[ 0 ] ,
1186+ status. unwrap ( ) ,
11871187 MigrationStatus :: InProgress {
11881188 status: "RenamedTarget" . to_string( )
11891189 }
@@ -1192,7 +1192,7 @@ async fn status_correct() {
11921192 advance ( & pic) . await ;
11931193 let status = get_status ( & pic, sender, & args) . await ;
11941194 assert_eq ! (
1195- status[ 0 ] ,
1195+ status. unwrap ( ) ,
11961196 MigrationStatus :: InProgress {
11971197 status: "UpdatedRoutingTable" . to_string( )
11981198 }
@@ -1201,7 +1201,7 @@ async fn status_correct() {
12011201 advance ( & pic) . await ;
12021202 let status = get_status ( & pic, sender, & args) . await ;
12031203 assert_eq ! (
1204- status[ 0 ] ,
1204+ status. unwrap ( ) ,
12051205 MigrationStatus :: InProgress {
12061206 status: "RoutingTableChangeAccepted" . to_string( )
12071207 }
@@ -1210,7 +1210,7 @@ async fn status_correct() {
12101210 advance ( & pic) . await ;
12111211 let status = get_status ( & pic, sender, & args) . await ;
12121212 assert_eq ! (
1213- status[ 0 ] ,
1213+ status. unwrap ( ) ,
12141214 MigrationStatus :: InProgress {
12151215 status: "SourceDeleted" . to_string( )
12161216 }
@@ -1219,7 +1219,7 @@ async fn status_correct() {
12191219 advance ( & pic) . await ;
12201220 let status = get_status ( & pic, sender, & args) . await ;
12211221 assert_eq ! (
1222- status[ 0 ] ,
1222+ status. unwrap ( ) ,
12231223 MigrationStatus :: InProgress {
12241224 status: "RestoredControllers" . to_string( )
12251225 }
@@ -1249,7 +1249,7 @@ async fn after_validation_source_not_stopped() {
12491249 advance ( & pic) . await ;
12501250 advance ( & pic) . await ;
12511251 let status = get_status ( & pic, sender, & args) . await ;
1252- let MigrationStatus :: Failed { ref reason, .. } = status[ 0 ] else {
1252+ let MigrationStatus :: Failed { ref reason, .. } = status. unwrap ( ) else {
12531253 panic ! ( )
12541254 } ;
12551255 assert_eq ! ( reason, & "Source is not stopped." . to_string( ) ) ;
@@ -1278,7 +1278,7 @@ async fn after_validation_target_not_stopped() {
12781278 advance ( & pic) . await ;
12791279 advance ( & pic) . await ;
12801280 let status = get_status ( & pic, sender, & args) . await ;
1281- let MigrationStatus :: Failed { ref reason, .. } = status[ 0 ] else {
1281+ let MigrationStatus :: Failed { ref reason, .. } = status. unwrap ( ) else {
12821282 panic ! ( )
12831283 } ;
12841284 assert_eq ! ( reason, & "Target is not stopped." . to_string( ) ) ;
@@ -1319,7 +1319,7 @@ async fn after_validation_target_has_snapshot() {
13191319 advance ( & pic) . await ;
13201320 advance ( & pic) . await ;
13211321 let status = get_status ( & pic, sender, & args) . await ;
1322- let MigrationStatus :: Failed { ref reason, .. } = status[ 0 ] else {
1322+ let MigrationStatus :: Failed { ref reason, .. } = status. unwrap ( ) else {
13231323 panic ! ( )
13241324 } ;
13251325 assert_eq ! ( reason, & "Target has snapshots." . to_string( ) ) ;
@@ -1361,7 +1361,7 @@ async fn after_validation_insufficient_cycles() {
13611361 advance ( & pic) . await ;
13621362 advance ( & pic) . await ;
13631363 let status = get_status ( & pic, sender, & args) . await ;
1364- let MigrationStatus :: Failed { ref reason, .. } = status[ 0 ] else {
1364+ let MigrationStatus :: Failed { ref reason, .. } = status. unwrap ( ) else {
13651365 panic ! ( )
13661366 } ;
13671367 assert ! ( reason. contains( "Source does not have sufficient cycles" ) ) ;
@@ -1391,7 +1391,7 @@ async fn failure_controllers_restored() {
13911391 advance ( & pic) . await ;
13921392 advance ( & pic) . await ;
13931393 let status = get_status ( & pic, sender, & args) . await ;
1394- let MigrationStatus :: Failed { .. } = status[ 0 ] else {
1394+ let MigrationStatus :: Failed { .. } = status. unwrap ( ) else {
13951395 panic ! ( )
13961396 } ;
13971397 let mut source_controllers_after = pic. get_controllers ( source) . await ;
@@ -1430,8 +1430,8 @@ async fn success_controllers_restored() {
14301430 advance ( & pic) . await ;
14311431 }
14321432 let status = get_status ( & pic, sender, & args) . await ;
1433- let MigrationStatus :: Succeeded { .. } = status[ 0 ] else {
1434- panic ! ( "status: {:?}" , status[ 0 ] ) ;
1433+ let MigrationStatus :: Succeeded { .. } = status. as_ref ( ) . unwrap ( ) else {
1434+ panic ! ( "status: {:?}" , status. unwrap ( ) ) ;
14351435 } ;
14361436 let mut source_controllers_after = pic. get_controllers ( source) . await ;
14371437 source_controllers_after. sort ( ) ;
@@ -1494,7 +1494,7 @@ async fn parallel_migrations() {
14941494 } ,
14951495 )
14961496 . await ;
1497- let MigrationStatus :: InProgress { ref status } = status[ 0 ] else {
1497+ let MigrationStatus :: InProgress { ref status } = status. unwrap ( ) else {
14981498 panic ! ( )
14991499 } ;
15001500 assert_eq ! ( status, "SourceDeleted" ) ;
0 commit comments