From 73020af0a77c6c973ef3d0f073610cb2f141ecdc Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sat, 5 Jun 2021 19:09:12 +0200 Subject: [PATCH] test: enable ignored tests with geth (#306) * test: enable ignored tests with geth * chore: enable celo * test: ignore for celo --- ethers-providers/Cargo.toml | 2 +- ethers-providers/src/provider.rs | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ethers-providers/Cargo.toml b/ethers-providers/Cargo.toml index d1ee587d..8606c2a5 100644 --- a/ethers-providers/Cargo.toml +++ b/ethers-providers/Cargo.toml @@ -49,6 +49,6 @@ tempfile = "3.2.0" [features] default = ["ws", "ipc"] -celo = ["ethers-core/celo"] +celo = ["ethers-core/celo", "ethers/celo"] ws = ["tokio", "tokio-tungstenite"] ipc = ["tokio", "tokio/io-util", "tokio-util", "bytes"] diff --git a/ethers-providers/src/provider.rs b/ethers-providers/src/provider.rs index 84b0f4a3..8aaa40a3 100644 --- a/ethers-providers/src/provider.rs +++ b/ethers-providers/src/provider.rs @@ -847,18 +847,18 @@ mod tests { use super::*; use crate::Http; use ethers_core::types::H256; + use ethers_core::utils::Geth; use futures_util::StreamExt; #[tokio::test] - #[ignore] - // Ganache new block filters are super buggy! This test must be run with - // geth or parity running e.g. `geth --dev --rpc --dev.period 1` + #[cfg_attr(feature = "celo", ignore)] async fn test_new_block_filter() { let num_blocks = 3; - - let provider = Provider::::try_from("http://localhost:8545") + let geth = Geth::new().block_time(2u64).spawn(); + let provider = Provider::::try_from(geth.endpoint()) .unwrap() .interval(Duration::from_millis(1000)); + let start_block = provider.get_block_number().await.unwrap(); let stream = provider.watch_blocks().await.unwrap().stream(); @@ -898,15 +898,12 @@ mod tests { assert_eq!(provider.is_signer().await, false); } - // this must be run with geth or parity since ganache-core still does not support - // eth_pendingTransactions, https://github.com/trufflesuite/ganache-core/issues/405 - // example command: `geth --dev --rpc --dev.period 1` #[tokio::test] - #[ignore] async fn test_new_pending_txs_filter() { let num_txs = 5; - let provider = Provider::::try_from("http://localhost:8545") + let geth = Geth::new().block_time(2u64).spawn(); + let provider = Provider::::try_from(geth.endpoint()) .unwrap() .interval(Duration::from_millis(1000)); let accounts = provider.get_accounts().await.unwrap();