Skip to content

Commit

Permalink
chore: rm flaky cache-path test (#9372)
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-atreya authored Nov 21, 2024
1 parent 057c8ac commit 9504f78
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 53 deletions.
18 changes: 0 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ alloy-transport = { version = "0.6.4", default-features = false }
alloy-transport-http = { version = "0.6.4", default-features = false }
alloy-transport-ipc = { version = "0.6.4", default-features = false }
alloy-transport-ws = { version = "0.6.4", default-features = false }
alloy-node-bindings = { version = "0.6.4", default-features = false }

## alloy-core
alloy-dyn-abi = "0.8.11"
Expand Down
1 change: 0 additions & 1 deletion crates/anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ alloy-rpc-client = { workspace = true, features = ["pubsub"] }
alloy-transport-ipc = { workspace = true, features = ["mock"] }
alloy-provider = { workspace = true, features = ["txpool-api"] }
alloy-transport-ws.workspace = true
alloy-node-bindings.workspace = true
alloy-json-rpc.workspace = true
alloy-pubsub.workspace = true
foundry-test-utils.workspace = true
Expand Down
34 changes: 1 addition & 33 deletions crates/anvil/tests/it/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

use alloy_consensus::EMPTY_ROOT_HASH;
use alloy_eips::BlockNumberOrTag;
use alloy_node_bindings::utils::run_with_tempdir;
use alloy_primitives::{Address, U256};
use alloy_primitives::Address;
use alloy_provider::Provider;
use anvil::{spawn, EthereumHardfork, NodeConfig};
use std::time::Duration;

#[tokio::test(flavor = "multi_thread")]
async fn test_can_change_mining_mode() {
Expand Down Expand Up @@ -120,33 +118,3 @@ async fn test_cancun_fields() {
assert!(block.header.blob_gas_used.is_some());
assert!(block.header.excess_blob_gas.is_some());
}

#[tokio::test(flavor = "multi_thread")]
#[cfg(not(windows))]
async fn test_cache_path() {
run_with_tempdir("custom-anvil-cache", |tmp_dir| async move {
let cache_path = tmp_dir.join("cache");
let (api, _handle) = spawn(
NodeConfig::test()
.with_cache_path(Some(cache_path.clone()))
.with_max_persisted_states(Some(5_usize))
.with_blocktime(Some(Duration::from_millis(1))),
)
.await;

api.anvil_mine(Some(U256::from(1000)), None).await.unwrap();

// sleep to ensure the cache is written
tokio::time::sleep(Duration::from_secs(2)).await;

assert!(cache_path.exists());
assert!(cache_path.read_dir().unwrap().count() > 0);

// Clean the directory, this is to prevent an error when temp_dir is dropped.
let _ = std::fs::remove_dir_all(cache_path);

//sleep to ensure OS file handles are released
tokio::time::sleep(Duration::from_secs(1)).await;
})
.await;
}

0 comments on commit 9504f78

Please sign in to comment.