From 1bf72d78178c25af690b3642fb485fa8092938c8 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Wed, 11 Dec 2024 16:46:02 +0100 Subject: [PATCH] test(autonomi): compare client bootstrapping --- autonomi/src/client/mod.rs | 1 - autonomi/tests/put.rs | 22 +++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index 670d77dab1..a9a761c1af 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -123,7 +123,6 @@ impl Client { if peers_with_p2p.len() < peers_len { tracing::warn!("Some bootstrap addresses have no peer ID, skipping them"); } - println!("TESTING: peers_with_p2p: {peers_with_p2p:?}"); let _ = network.add_peer_addresses(peers_with_p2p).await; Ok(Self { diff --git a/autonomi/tests/put.rs b/autonomi/tests/put.rs index ca4a808c7e..c434c1c545 100644 --- a/autonomi/tests/put.rs +++ b/autonomi/tests/put.rs @@ -9,11 +9,27 @@ use ant_logging::LogBuilder; use autonomi::{client::ClientConfig, Client}; use eyre::Result; -use test_utils::{evm::get_funded_wallet, gen_random_data}; +use test_utils::{evm::get_funded_wallet, gen_random_data, peers_from_env}; #[tokio::test] -async fn put() -> Result<()> { - let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("put", false); +async fn put_1() -> Result<()> { + let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("put_1", false); + + let client = Client::connect(&peers_from_env()?).await?; + let wallet = get_funded_wallet(); + let data = gen_random_data(1024 * 1024 * 10); + + let addr = client.data_put_public(data.clone(), wallet.into()).await?; + + let data_fetched = client.data_get_public(addr).await?; + assert_eq!(data, data_fetched, "data fetched should match data put"); + + Ok(()) +} + +#[tokio::test] +async fn put_2() -> Result<()> { + let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("put_2", false); let client = Client::init_with_config(ClientConfig { local: true,