Skip to content

Commit

Permalink
chore(providers-alloy): blob provider fallback tests (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell authored Oct 7, 2024
1 parent 52cb406 commit 4bf4264
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions crates/providers-alloy/src/blob_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,29 @@ mod tests {
use alloy_primitives::b256;
use kona_primitives::{APIConfigResponse, APIGenesisResponse, APIGetBlobSidecarsResponse};

#[test]
fn test_build_online_provider_with_fallback() {
let builder = OnlineBlobProviderBuilder::new()
.with_genesis_time(10)
.with_slot_interval(12)
.with_beacon_client(OnlineBeaconClient::new_http("http://localhost:5052".into()))
.with_fallback_provider(OnlineBeaconClient::new_http("http://localhost:5053".into()))
.build();
assert!(builder.fallback.is_some());
}

#[test]
fn test_into_online_provider_with_fallback() {
let builder = OnlineBlobProviderBuilder::default()
.with_genesis_time(10)
.with_slot_interval(12)
.with_primary("http://localhost:5052".into())
.with_fallback(Some("http://localhost:5053".into()));
let provider: OnlineBlobProviderWithFallback<OnlineBeaconClient, OnlineBeaconClient> =
builder.into();
assert!(provider.fallback.is_some());
}

#[tokio::test]
async fn test_load_config_succeeds() {
let genesis_time = 10;
Expand Down

0 comments on commit 4bf4264

Please sign in to comment.