#![allow(
clippy::unwrap_used,
clippy::expect_used,
clippy::panic,
clippy::cast_precision_loss,
clippy::cast_possible_truncation,
clippy::too_many_lines
)]
use saorsa_core::{MultiAddr, NodeConfig as CoreNodeConfig, P2PNode};
use std::env;
use std::net::SocketAddr;
use std::time::Duration;
fn get_bootstrap_addrs() -> Vec<SocketAddr> {
let bootstrap_str = env::var("ANT_TEST_BOOTSTRAP")
.unwrap_or_else(|_| "142.93.52.129:12000,24.199.82.114:12000".to_string());
bootstrap_str
.split(',')
.filter_map(|s| s.trim().parse().ok())
.collect()
}
async fn create_testnet_client() -> P2PNode {
let bootstrap_addrs = get_bootstrap_addrs();
println!("Connecting to testnet via: {bootstrap_addrs:?}");
let mut config = CoreNodeConfig::builder()
.local(true)
.build()
.expect("Failed to create config");
config.bootstrap_peers = bootstrap_addrs
.iter()
.map(|addr| MultiAddr::quic(*addr))
.collect();
let node = P2PNode::new(config)
.await
.expect("Failed to create P2P node");
node.start().await.expect("Failed to start P2P node");
tokio::time::sleep(Duration::from_secs(5)).await;
println!(
"Connected to testnet with {} peers",
node.peer_count().await
);
node
}
#[tokio::test]
#[ignore = "needs rewrite: dht_put/dht_get removed in saorsa-core 0.16"]
async fn run_load_test() {
let _node = create_testnet_client().await;
unimplemented!("rewrite with QuantumClient");
}
#[tokio::test]
#[ignore = "needs rewrite: dht_put/dht_get removed in saorsa-core 0.16"]
async fn run_verify_chunks() {
let _node = create_testnet_client().await;
unimplemented!("rewrite with QuantumClient");
}
#[tokio::test]
#[ignore = "needs rewrite: dht_put/dht_get removed in saorsa-core 0.16"]
async fn run_comprehensive_data_tests() {
let _node = create_testnet_client().await;
unimplemented!("rewrite with QuantumClient");
}