Skip to content

Commit

Permalink
test(autonomi): compare client bootstrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
b-zee committed Dec 11, 2024
1 parent 1aa5dd3 commit 1bf72d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 0 additions & 1 deletion autonomi/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 19 additions & 3 deletions autonomi/tests/put.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1bf72d7

Please sign in to comment.