Skip to content

Commit 8c3682c

Browse files
committed
chore: expect checked error s.t. window isn't broken.
1 parent ef06986 commit 8c3682c

File tree

3 files changed

+53
-15
lines changed

3 files changed

+53
-15
lines changed

checks/executor/checks/sketchpad/src/global_storage_includes.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub mod test {
33

44
use migration_executor_test_global_storage_includes_criterion::GlobalStorageIncludes;
55
use migration_executor_test_types::{
6-
check::checked_migration,
6+
check::{checked_migration, CheckError},
77
criterion::movement_executor::maptos_opt_executor::{
88
aptos_sdk::{
99
transaction_builder::TransactionFactory,
@@ -16,6 +16,7 @@ pub mod test {
1616
};
1717
use mtma_null_core::config::Config as MtmaNullConfig;
1818
use rand::SeedableRng;
19+
use tracing::info;
1920

2021
#[tokio::test]
2122
#[tracing_test::traced_test]
@@ -58,13 +59,24 @@ pub mod test {
5859
let migration = migration_config.build()?;
5960

6061
// run the checked migration
61-
checked_migration(
62+
match checked_migration(
6263
&mut movement_executor,
6364
&prelude,
6465
&migration,
6566
vec![Box::new(GlobalStorageIncludes::new())],
6667
)
67-
.await?;
68+
.await
69+
{
70+
Ok(_) => {
71+
return Err(anyhow::anyhow!("Migration should have failed"));
72+
}
73+
Err(err) => match err {
74+
CheckError::Criteria(e) => info!("Migration failed as expected: {:?}", e),
75+
e => {
76+
return Err(e.into());
77+
}
78+
},
79+
}
6880

6981
Ok(())
7082
}

checks/executor/checks/sketchpad/src/global_storage_injective.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub mod test {
33

44
use migration_executor_test_global_storage_injective_criterion::GlobalStorageInjective;
55
use migration_executor_test_types::{
6-
check::checked_migration,
6+
check::{checked_migration, CheckError},
77
criterion::movement_executor::maptos_opt_executor::{
88
aptos_sdk::{
99
transaction_builder::TransactionFactory,
@@ -16,6 +16,7 @@ pub mod test {
1616
};
1717
use mtma_null_core::config::Config as MtmaNullConfig;
1818
use rand::SeedableRng;
19+
use tracing::info;
1920

2021
#[tokio::test]
2122
async fn test_global_storage_injective_null() -> Result<(), anyhow::Error> {
@@ -57,13 +58,24 @@ pub mod test {
5758
let migration = migration_config.build()?;
5859

5960
// run the checked migration
60-
checked_migration(
61+
match checked_migration(
6162
&mut movement_executor,
6263
&prelude,
6364
&migration,
6465
vec![Box::new(GlobalStorageInjective::new())],
6566
)
66-
.await?;
67+
.await
68+
{
69+
Ok(_) => {
70+
return Err(anyhow::anyhow!("Migration should have failed"));
71+
}
72+
Err(err) => match err {
73+
CheckError::Criteria(e) => info!("Migration failed as expected: {:?}", e),
74+
e => {
75+
return Err(e.into());
76+
}
77+
},
78+
}
6779

6880
Ok(())
6981
}

checks/executor/checks/sketchpad/src/global_storage_not_empty.rs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ pub mod test {
33

44
use migration_executor_test_global_storage_not_empty_criterion::GlobalStorageNotEmpty;
55
use migration_executor_test_types::{
6-
check::checked_migration,
7-
criterion::movement_executor::maptos_opt_executor::{
8-
aptos_sdk::{
9-
transaction_builder::TransactionFactory,
10-
types::{AccountKey, LocalAccount},
6+
check::{checked_migration, CheckError},
7+
criterion::movement_executor::{
8+
maptos_opt_executor::{
9+
aptos_sdk::{
10+
transaction_builder::TransactionFactory,
11+
types::{AccountKey, LocalAccount},
12+
},
13+
aptos_types::account_config::aptos_test_root_address,
1114
},
12-
aptos_types::account_config::aptos_test_root_address,
15+
MovementExecutor, MovementOptExecutor,
1316
},
14-
criterion::movement_executor::{MovementExecutor, MovementOptExecutor},
1517
prelude::Prelude,
1618
};
1719
use mtma_null_core::config::Config as MtmaNullConfig;
1820
use rand::SeedableRng;
21+
use tracing::info;
1922

2023
#[tokio::test]
2124
async fn test_global_storage_injective_null() -> Result<(), anyhow::Error> {
@@ -57,13 +60,24 @@ pub mod test {
5760
let migration = migration_config.build()?;
5861

5962
// run the checked migration
60-
checked_migration(
63+
match checked_migration(
6164
&mut movement_executor,
6265
&prelude,
6366
&migration,
6467
vec![Box::new(GlobalStorageNotEmpty::new())],
6568
)
66-
.await?;
69+
.await
70+
{
71+
Ok(_) => {
72+
return Err(anyhow::anyhow!("Migration should have failed"));
73+
}
74+
Err(err) => match err {
75+
CheckError::Criteria(e) => info!("Migration failed as expected: {:?}", e),
76+
e => {
77+
return Err(e.into());
78+
}
79+
},
80+
}
6781

6882
Ok(())
6983
}

0 commit comments

Comments
 (0)