Skip to content

Commit

Permalink
chore(providers): Codecov Ignore Alloy-backed Providers (#633)
Browse files Browse the repository at this point in the history
* chore(providers): ignore codecov for flaky online tests

* fix(codecov): tests
  • Loading branch information
refcell authored Oct 5, 2024
1 parent a2ec985 commit ed6c0db
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ ignore:
- "**/test_util*"
- "**/tests*"
- "bin/"
- "crates/providers-alloy/src/alloy_providers.rs" # Flaky testing with online providers
- "crates/providers-alloy/src/beacon_client.rs" # Flaky testing with online providers

# Make comments less noisy
comment:
Expand Down
43 changes: 43 additions & 0 deletions crates/providers-alloy/src/alloy_providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,46 @@ impl L2ChainProvider for AlloyL2ChainProvider {
Ok(sys_config)
}
}

#[cfg(test)]
mod tests {
use super::*;

fn default_provider() -> ReqwestProvider {
ReqwestProvider::new_http("https://docs-demo.quiknode.pro/".try_into().unwrap())
}

#[tokio::test]
async fn test_alloy_chain_provider_latest_block_number() {
let mut provider = AlloyChainProvider::new(default_provider());
let number = provider.latest_block_number().await.unwrap();
assert!(number > 0);
}

#[tokio::test]
async fn test_alloy_chain_provider_chain_id() {
let mut provider = AlloyChainProvider::new(default_provider());
let chain_id = provider.chain_id().await.unwrap();
assert_eq!(chain_id, 1);
}

#[tokio::test]
async fn test_alloy_l2_chain_provider_latest_block_number() {
let mut provider = AlloyL2ChainProvider::new_http(
"https://docs-demo.quiknode.pro/".try_into().unwrap(),
Arc::new(RollupConfig::default()),
);
let number = provider.latest_block_number().await.unwrap();
assert!(number > 0);
}

#[tokio::test]
async fn test_alloy_l2_chain_provider_chain_id() {
let mut provider = AlloyL2ChainProvider::new_http(
"https://docs-demo.quiknode.pro/".try_into().unwrap(),
Arc::new(RollupConfig::default()),
);
let chain_id = provider.chain_id().await.unwrap();
assert_eq!(chain_id, 1);
}
}

0 comments on commit ed6c0db

Please sign in to comment.