Skip to content

Commit c448448

Browse files
committed
fix: broken test
1 parent 9cb2398 commit c448448

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

crates/core/src/surfnet/svm.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5713,7 +5713,7 @@ mod tests {
57135713
use surfpool_types::AccountSnapshot;
57145714
use tempfile::NamedTempFile;
57155715

5716-
let (mut svm, _events_rx, _geyser_rx) = SurfnetSvm::new();
5716+
let (mut svm, _events_rx, _geyser_rx) = SurfnetSvm::new(None, "test").unwrap();
57175717

57185718
// Create test accounts with different characteristics
57195719
let test_accounts: Vec<(Pubkey, Account)> = vec![
@@ -5760,7 +5760,10 @@ mod tests {
57605760

57615761
// Verify accounts are set correctly
57625762
for (pubkey, expected_account) in &test_accounts {
5763-
let actual_account = svm.get_account(pubkey).expect("Account should exist");
5763+
let actual_account = svm
5764+
.get_account(pubkey)
5765+
.expect("get_account should not error")
5766+
.expect("Account should exist");
57645767
assert_eq!(
57655768
actual_account.lamports, expected_account.lamports,
57665769
"Lamports should match for {}",
@@ -5804,12 +5807,14 @@ mod tests {
58045807
let snapshot_path = temp_file.path().to_str().unwrap();
58055808

58065809
// Create a new SVM instance and restore the snapshot
5807-
let (mut svm2, _events_rx2, _geyser_rx2) = SurfnetSvm::new();
5810+
let (mut svm2, _events_rx2, _geyser_rx2) = SurfnetSvm::new(None, "test").unwrap();
58085811

58095812
// Verify accounts don't exist in new SVM
58105813
for (pubkey, _) in &test_accounts {
58115814
assert!(
5812-
svm2.get_account(pubkey).is_none(),
5815+
svm2.get_account(pubkey)
5816+
.expect("get_account should not error")
5817+
.is_none(),
58135818
"Account {} should not exist in new SVM before restore",
58145819
pubkey
58155820
);
@@ -5830,7 +5835,8 @@ mod tests {
58305835
for (pubkey, expected_account) in &test_accounts {
58315836
let restored_account = svm2
58325837
.get_account(pubkey)
5833-
.expect(&format!("Account {} should exist after restore", pubkey));
5838+
.expect("get_account should not error")
5839+
.unwrap_or_else(|| panic!("Account {} should exist after restore", pubkey));
58345840

58355841
assert_eq!(
58365842
restored_account.lamports, expected_account.lamports,
@@ -5862,7 +5868,7 @@ mod tests {
58625868

58635869
#[test]
58645870
fn test_snapshot_restore_invalid_file() {
5865-
let (mut svm, _events_rx, _geyser_rx) = SurfnetSvm::new();
5871+
let (mut svm, _events_rx, _geyser_rx) = SurfnetSvm::new(None, "test").unwrap();
58665872

58675873
// Test with non-existent file
58685874
let result = svm.restore_from_snapshot("/nonexistent/path/to/snapshot.json");
@@ -5890,7 +5896,7 @@ mod tests {
58905896
use surfpool_types::AccountSnapshot;
58915897
use tempfile::NamedTempFile;
58925898

5893-
let (mut svm, _events_rx, _geyser_rx) = SurfnetSvm::new();
5899+
let (mut svm, _events_rx, _geyser_rx) = SurfnetSvm::new(None, "test").unwrap();
58945900

58955901
// Create a snapshot with one valid and one invalid account
58965902
let mut snapshot: HashMap<String, AccountSnapshot> = HashMap::new();
@@ -5941,6 +5947,7 @@ mod tests {
59415947
// Verify the valid account was restored
59425948
let restored_account = svm
59435949
.get_account(&valid_pubkey)
5950+
.expect("get_account should not error")
59445951
.expect("Valid account should be restored");
59455952
assert_eq!(restored_account.lamports, 1_000_000);
59465953
}

0 commit comments

Comments
 (0)