chore: tokio::test is now single-threaded
This commit is contained in:
parent
af19ed833b
commit
dc0c6a0af0
@ -185,7 +185,7 @@ mod tests {
|
||||
routes(&ipfs, shutdown_tx)
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn not_found_as_plaintext() {
|
||||
let routes = testing_routes().await;
|
||||
let resp = warp::test::request()
|
||||
@ -199,7 +199,7 @@ mod tests {
|
||||
assert_eq!(resp.body(), "404 page not found");
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn invalid_peer_id_as_messageresponse() {
|
||||
let routes = testing_routes().await;
|
||||
let resp = warp::test::request()
|
||||
|
@ -548,7 +548,7 @@ mod tests {
|
||||
})
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn url_hacked_args() {
|
||||
let response = request()
|
||||
.path("/pubsub/pub?arg=some_channel&arg=foobar")
|
||||
@ -558,7 +558,7 @@ mod tests {
|
||||
assert_eq!(body, r#"{"message":"foobar","topic":"some_channel"}"#);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn message_in_body() {
|
||||
let response = request()
|
||||
.path("/pubsub/pub?arg=some_channel")
|
||||
|
@ -216,7 +216,7 @@ mod tests {
|
||||
use std::collections::HashSet;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_inner_local() {
|
||||
let filter = local(&*preloaded_testing_ipfs().await);
|
||||
|
||||
@ -263,7 +263,7 @@ mod tests {
|
||||
assert!(diff.is_empty(), "{:?}", diff);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn refs_with_path() {
|
||||
let ipfs = preloaded_testing_ipfs().await;
|
||||
|
||||
|
@ -303,7 +303,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn very_long_file_and_symlink_names() {
|
||||
let ipfs = Node::new("test_node").await;
|
||||
|
||||
@ -359,7 +359,7 @@ mod tests {
|
||||
assert_eq!(found, expected);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn get_multiblock_file() {
|
||||
let ipfs = Node::new("test_node").await;
|
||||
|
||||
|
@ -378,7 +378,7 @@ impl<D: fmt::Display> serde::Serialize for Quoted<D> {
|
||||
mod tests {
|
||||
use crate::v0::root_files::add;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn add_single_block_file() {
|
||||
let ipfs = tokio_ipfs().await;
|
||||
|
||||
|
20
src/dag.rs
20
src/dag.rs
@ -600,7 +600,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::{make_ipld, Node};
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_resolve_root_cid() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
let dag = IpldDag::new(ipfs);
|
||||
@ -610,7 +610,7 @@ mod tests {
|
||||
assert_eq!(res, data);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_resolve_array_elem() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
let dag = IpldDag::new(ipfs);
|
||||
@ -623,7 +623,7 @@ mod tests {
|
||||
assert_eq!(res, make_ipld!(2));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_resolve_nested_array_elem() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
let dag = IpldDag::new(ipfs);
|
||||
@ -636,7 +636,7 @@ mod tests {
|
||||
assert_eq!(res, make_ipld!(2));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_resolve_object_elem() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
let dag = IpldDag::new(ipfs);
|
||||
@ -651,7 +651,7 @@ mod tests {
|
||||
assert_eq!(res, make_ipld!(false));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_resolve_cid_elem() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
let dag = IpldDag::new(ipfs);
|
||||
@ -845,7 +845,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn resolve_through_link() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
let dag = IpldDag::new(ipfs);
|
||||
@ -874,7 +874,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn fail_resolving_first_segment() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
let dag = IpldDag::new(ipfs);
|
||||
@ -890,7 +890,7 @@ mod tests {
|
||||
assert_eq!(e.to_string(), format!("no link named \"1\" under {}", cid2));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn fail_resolving_last_segment() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
let dag = IpldDag::new(ipfs);
|
||||
@ -906,7 +906,7 @@ mod tests {
|
||||
assert_eq!(e.to_string(), format!("no link named \"a\" under {}", cid1));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn fail_resolving_through_file() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
|
||||
@ -938,7 +938,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn fail_resolving_through_dir() {
|
||||
let Node { ipfs, .. } = Node::new("test_node").await;
|
||||
|
||||
|
@ -120,14 +120,14 @@ pub async fn resolve(domain: &str) -> Result<IpfsPath, Error> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn test_resolve1() {
|
||||
let res = resolve("ipfs.io").await.unwrap().to_string();
|
||||
assert_eq!(res, "/ipns/website.ipfs.io");
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn test_resolve2() {
|
||||
let res = resolve("website.ipfs.io").await.unwrap().to_string();
|
||||
|
@ -1756,7 +1756,7 @@ mod tests {
|
||||
use crate::make_ipld;
|
||||
use multihash::Sha2_256;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_put_and_get_block() {
|
||||
let ipfs = Node::new("test_node").await;
|
||||
|
||||
@ -1769,7 +1769,7 @@ mod tests {
|
||||
assert_eq!(block, new_block);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_put_and_get_dag() {
|
||||
let ipfs = Node::new("test_node").await;
|
||||
|
||||
@ -1779,7 +1779,7 @@ mod tests {
|
||||
assert_eq!(data, new_data);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_pin_and_unpin() {
|
||||
let ipfs = Node::new("test_node").await;
|
||||
|
||||
|
@ -265,7 +265,7 @@ mod tests {
|
||||
use libp2p::{multiaddr::Protocol, multihash::Multihash, swarm::Swarm};
|
||||
use std::convert::TryInto;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn swarm_api() {
|
||||
let (peer1_id, trans) = mk_transport();
|
||||
let mut swarm1 = Swarm::new(trans, SwarmApi::default(), peer1_id);
|
||||
|
@ -369,7 +369,7 @@ mod tests {
|
||||
assert_eq!(links, ["african.txt", "americas.txt", "australian.txt",]);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn all_refs_from_root() {
|
||||
let Node { ipfs, .. } = preloaded_testing_ipfs().await;
|
||||
|
||||
@ -416,7 +416,7 @@ mod tests {
|
||||
assert_edges(&expected, all_edges.as_slice());
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn all_unique_refs_from_root() {
|
||||
let Node { ipfs, .. } = preloaded_testing_ipfs().await;
|
||||
|
||||
|
@ -56,7 +56,7 @@ macro_rules! pinstore_interface_tests {
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn pin_direct_twice_is_good() {
|
||||
let repo = DSTestContext::with($factory).await;
|
||||
|
||||
@ -84,7 +84,7 @@ macro_rules! pinstore_interface_tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn cannot_recursively_unpin_unpinned() {
|
||||
let repo = DSTestContext::with($factory).await;
|
||||
// root/nested/deeper: QmX5S2xLu32K6WxWnyLeChQFbDHy79ULV9feJYH2Hy9bgp
|
||||
@ -103,7 +103,7 @@ macro_rules! pinstore_interface_tests {
|
||||
assert_eq!(e.to_string(), "not pinned or pinned indirectly");
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn cannot_unpin_indirect() {
|
||||
let repo = DSTestContext::with($factory).await;
|
||||
// root/nested/deeper: QmX5S2xLu32K6WxWnyLeChQFbDHy79ULV9feJYH2Hy9bgp
|
||||
@ -146,7 +146,7 @@ macro_rules! pinstore_interface_tests {
|
||||
assert_eq!(e.to_string(), "not pinned or pinned indirectly");
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn can_pin_direct_as_recursive() {
|
||||
// the other way around doesn't work
|
||||
let repo = DSTestContext::with($factory).await;
|
||||
@ -188,7 +188,7 @@ macro_rules! pinstore_interface_tests {
|
||||
assert!(both.is_empty(), "{:?}", both);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn pin_recursive_pins_all_blocks() {
|
||||
let repo = DSTestContext::with($factory).await;
|
||||
|
||||
@ -221,7 +221,7 @@ macro_rules! pinstore_interface_tests {
|
||||
assert!(both.is_empty(), "{:?}", both);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn indirect_can_be_pinned_directly() {
|
||||
let repo = DSTestContext::with($factory).await;
|
||||
|
||||
@ -261,7 +261,7 @@ macro_rules! pinstore_interface_tests {
|
||||
assert!(both.is_empty(), "{:?}", both);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn direct_and_indirect_when_parent_unpinned() {
|
||||
let repo = DSTestContext::with($factory).await;
|
||||
|
||||
@ -311,7 +311,7 @@ macro_rules! pinstore_interface_tests {
|
||||
assert!(one.is_empty(), "{:?}", one);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn cannot_pin_recursively_pinned_directly() {
|
||||
// this is a bit of odd as other ops are additive
|
||||
let repo = DSTestContext::with($factory).await;
|
||||
|
@ -443,7 +443,7 @@ mod tests {
|
||||
use std::env::temp_dir;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_fs_blockstore() {
|
||||
let mut tmp = temp_dir();
|
||||
tmp.push("blockstore1");
|
||||
@ -481,7 +481,7 @@ mod tests {
|
||||
std::fs::remove_dir_all(tmp).ok();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_fs_blockstore_open() {
|
||||
let mut tmp = temp_dir();
|
||||
tmp.push("blockstore2");
|
||||
@ -506,7 +506,7 @@ mod tests {
|
||||
std::fs::remove_dir_all(&tmp).ok();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_fs_blockstore_list() {
|
||||
let mut tmp = temp_dir();
|
||||
tmp.push("blockstore_list");
|
||||
@ -530,7 +530,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn race_to_insert_new() {
|
||||
// FIXME: why not tempdir?
|
||||
let mut tmp = temp_dir();
|
||||
@ -561,7 +561,7 @@ mod tests {
|
||||
assert_eq!(existing, count - 1);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn race_to_insert_with_existing() {
|
||||
// FIXME: why not tempdir?
|
||||
let mut tmp = temp_dir();
|
||||
@ -634,7 +634,7 @@ mod tests {
|
||||
(writes, existing)
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn remove() {
|
||||
// FIXME: why not tempdir?
|
||||
let mut tmp = temp_dir();
|
||||
|
@ -685,7 +685,7 @@ mod tests {
|
||||
use multihash::Sha2_256;
|
||||
use std::env::temp_dir;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_mem_blockstore() {
|
||||
let tmp = temp_dir();
|
||||
let store = MemBlockStore::new(tmp);
|
||||
@ -718,7 +718,7 @@ mod tests {
|
||||
assert_eq!(get.await.unwrap(), None);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_mem_blockstore_list() {
|
||||
let tmp = temp_dir();
|
||||
let mem_store = MemBlockStore::new(tmp);
|
||||
@ -741,7 +741,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn test_mem_datastore() {
|
||||
let tmp = temp_dir();
|
||||
let store = MemDataStore::new(tmp);
|
||||
|
@ -429,7 +429,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn subscription_basics() {
|
||||
let registry = SubscriptionRegistry::<u32, ()>::default();
|
||||
let s1 = registry.create_subscription(0.into(), None);
|
||||
@ -441,7 +441,7 @@ mod tests {
|
||||
assert_eq!(s3.await.unwrap(), 10);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn subscription_cancelled_on_dropping_registry() {
|
||||
let registry = SubscriptionRegistry::<u32, ()>::default();
|
||||
let s1 = registry.create_subscription(0.into(), None);
|
||||
@ -449,7 +449,7 @@ mod tests {
|
||||
assert_eq!(s1.await, Err(SubscriptionErr::Cancelled));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn subscription_cancelled_on_shutdown() {
|
||||
let registry = SubscriptionRegistry::<u32, ()>::default();
|
||||
let s1 = registry.create_subscription(0.into(), None);
|
||||
@ -457,7 +457,7 @@ mod tests {
|
||||
assert_eq!(s1.await, Err(SubscriptionErr::Cancelled));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn new_subscriptions_cancelled_after_shutdown() {
|
||||
let registry = SubscriptionRegistry::<u32, ()>::default();
|
||||
registry.shutdown();
|
||||
@ -465,7 +465,7 @@ mod tests {
|
||||
assert_eq!(s1.await, Err(SubscriptionErr::Cancelled));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn dropping_subscription_future_after_registering() {
|
||||
use std::time::Duration;
|
||||
use tokio::time::timeout;
|
||||
@ -488,7 +488,7 @@ mod tests {
|
||||
|
||||
// this test is designed to verify that the subscription registry is working properly
|
||||
// and doesn't break even under extreme conditions
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn subscription_stress_test() {
|
||||
use rand::{seq::SliceRandom, Rng};
|
||||
|
@ -8,7 +8,7 @@ mod common;
|
||||
use common::{spawn_nodes, Topology};
|
||||
|
||||
// Ensure that the Bitswap object doesn't leak.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn check_bitswap_cleanups() {
|
||||
// create a few nodes and connect the first one to others
|
||||
let mut nodes = spawn_nodes(3, Topology::Star).await;
|
||||
@ -41,7 +41,7 @@ async fn check_bitswap_cleanups() {
|
||||
// testing the bitswap protocol (though it would be advised to uncomment
|
||||
// the tracing_subscriber for stress-testing purposes)
|
||||
#[ignore]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn bitswap_stress_test() {
|
||||
fn filter(i: usize) -> bool {
|
||||
i % 2 == 0
|
||||
|
@ -15,7 +15,7 @@ fn create_block() -> Block {
|
||||
}
|
||||
|
||||
// verify that a put block can be received via get_block and the data matches
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn two_node_put_get() {
|
||||
let nodes = spawn_nodes(2, Topology::Line).await;
|
||||
let block = create_block();
|
||||
@ -30,7 +30,7 @@ async fn two_node_put_get() {
|
||||
}
|
||||
|
||||
// check that a long line of nodes still works with get_block
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn long_get_block() {
|
||||
// this number could be higher, but it starts hanging above ~24
|
||||
|
@ -68,7 +68,7 @@ mod tests {
|
||||
|
||||
const N: usize = 5;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn check_topology_line() {
|
||||
let nodes = spawn_nodes(N, Topology::Line).await;
|
||||
|
||||
@ -81,7 +81,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn check_topology_ring() {
|
||||
let nodes = spawn_nodes(N, Topology::Ring).await;
|
||||
|
||||
@ -90,7 +90,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn check_topology_mesh() {
|
||||
let nodes = spawn_nodes(N, Topology::Mesh).await;
|
||||
|
||||
@ -99,7 +99,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn check_topology_star() {
|
||||
let nodes = spawn_nodes(N, Topology::Star).await;
|
||||
|
||||
|
@ -11,7 +11,7 @@ use common::interop::ForeignNode;
|
||||
const TIMEOUT: Duration = Duration::from_secs(5);
|
||||
|
||||
// Make sure two instances of ipfs can be connected by `Multiaddr`.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn connect_two_nodes_by_addr() {
|
||||
let node_a = Node::new("a").await;
|
||||
|
||||
@ -27,7 +27,7 @@ async fn connect_two_nodes_by_addr() {
|
||||
}
|
||||
|
||||
// Make sure only a `Multiaddr` with `/p2p/` can be used to connect.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
#[should_panic(expected = "called `Result::unwrap()` on an `Err` value: MissingProtocolP2p")]
|
||||
async fn dont_connect_without_p2p() {
|
||||
let node_a = Node::new("a").await;
|
||||
@ -45,7 +45,7 @@ async fn dont_connect_without_p2p() {
|
||||
|
||||
// Make sure two instances of ipfs can be connected by `PeerId`.
|
||||
#[ignore = "connecting just by PeerId is not currently supported"]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn connect_two_nodes_by_peer_id() {
|
||||
let node_a = Node::new("a").await;
|
||||
let node_b = Node::new("b").await;
|
||||
@ -63,7 +63,7 @@ async fn connect_two_nodes_by_peer_id() {
|
||||
}
|
||||
|
||||
// Ensure that duplicate connection attempts don't cause hangs.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn connect_duplicate_multiaddr() {
|
||||
let node_a = Node::new("a").await;
|
||||
let node_b = Node::new("b").await;
|
||||
@ -79,7 +79,7 @@ async fn connect_duplicate_multiaddr() {
|
||||
|
||||
// More complicated one to the above; first node will have two listening addresses and the second
|
||||
// one should dial both of the addresses, resulting in two connections.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn connect_two_nodes_with_two_connections_doesnt_panic() {
|
||||
let node_a = Node::new("a").await;
|
||||
let node_b = Node::new("b").await;
|
||||
|
@ -15,7 +15,7 @@ fn strip_peer_id(addr: Multiaddr) -> Multiaddr {
|
||||
}
|
||||
|
||||
/// Check if `Ipfs::find_peer` works without DHT involvement.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn find_peer_local() {
|
||||
let nodes = spawn_nodes(2, Topology::None).await;
|
||||
nodes[0].connect(nodes[1].addrs[0].clone()).await.unwrap();
|
||||
@ -101,7 +101,7 @@ async fn spawn_bootstrapped_nodes(n: usize) -> (Vec<Node>, Option<ForeignNode>)
|
||||
}
|
||||
|
||||
/// Check if `Ipfs::find_peer` works using DHT.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn dht_find_peer() {
|
||||
// works for numbers >=2, though 2 would essentially just
|
||||
// be the same as find_peer_local, so it should be higher
|
||||
@ -118,7 +118,7 @@ async fn dht_find_peer() {
|
||||
assert_eq!(found_addrs, vec![to_be_found]);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn dht_get_closest_peers() {
|
||||
const CHAIN_LEN: usize = 10;
|
||||
let (nodes, _foreign_node) = spawn_bootstrapped_nodes(CHAIN_LEN).await;
|
||||
@ -130,7 +130,7 @@ async fn dht_get_closest_peers() {
|
||||
}
|
||||
|
||||
#[ignore = "targets an actual bootstrapper, so random failures can happen"]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn dht_popular_content_discovery() {
|
||||
let peer = Node::new("a").await;
|
||||
|
||||
@ -147,7 +147,7 @@ async fn dht_popular_content_discovery() {
|
||||
}
|
||||
|
||||
/// Check if Ipfs::{get_providers, provide} does its job.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn dht_providing() {
|
||||
const CHAIN_LEN: usize = 10;
|
||||
let (nodes, foreign_node) = spawn_bootstrapped_nodes(CHAIN_LEN).await;
|
||||
@ -176,7 +176,7 @@ async fn dht_providing() {
|
||||
}
|
||||
|
||||
/// Check if Ipfs::{get, put} does its job.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn dht_get_put() {
|
||||
const CHAIN_LEN: usize = 10;
|
||||
let (nodes, foreign_node) = spawn_bootstrapped_nodes(CHAIN_LEN).await;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn multiple_consecutive_ephemeral_listening_addresses() {
|
||||
let node = ipfs::Node::new("test_node").await;
|
||||
|
||||
@ -12,7 +12,7 @@ async fn multiple_consecutive_ephemeral_listening_addresses() {
|
||||
assert_ne!(first, second);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn multiple_concurrent_ephemeral_listening_addresses_on_same_ip() {
|
||||
let node = ipfs::Node::new("test_node").await;
|
||||
|
||||
@ -41,7 +41,7 @@ async fn multiple_concurrent_ephemeral_listening_addresses_on_same_ip() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
async fn multiple_concurrent_ephemeral_listening_addresses_on_different_ip() {
|
||||
let node = ipfs::Node::new("test_node").await;
|
||||
@ -59,7 +59,7 @@ async fn multiple_concurrent_ephemeral_listening_addresses_on_different_ip() {
|
||||
second.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn adding_unspecified_addr_resolves_with_first() {
|
||||
let node = ipfs::Node::new("test_node").await;
|
||||
// there is no test in trying to match this with others as ... that would be quite
|
||||
@ -69,7 +69,7 @@ async fn adding_unspecified_addr_resolves_with_first() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn listening_for_multiple_unspecified_addresses() {
|
||||
let node = ipfs::Node::new("test_node").await;
|
||||
// there is no test in trying to match this with others as ... that would be quite
|
||||
@ -93,7 +93,7 @@ async fn listening_for_multiple_unspecified_addresses() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn remove_listening_address() {
|
||||
let node = ipfs::Node::new("test_node").await;
|
||||
|
||||
@ -117,7 +117,7 @@ fn remove_listening_address_before_completing() {
|
||||
// "immediatedly".
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn pre_configured_listening_addrs() {
|
||||
use ipfs::{IpfsOptions, MultiaddrWithPeerId, MultiaddrWithoutPeerId, Node};
|
||||
use libp2p::Multiaddr;
|
||||
|
@ -7,14 +7,14 @@ use tokio::time::timeout;
|
||||
mod common;
|
||||
use common::{spawn_nodes, Topology};
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn subscribe_only_once() {
|
||||
let a = Node::new("test_node").await;
|
||||
let _stream = a.pubsub_subscribe("some_topic".into()).await.unwrap();
|
||||
a.pubsub_subscribe("some_topic".into()).await.unwrap_err();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn resubscribe_after_unsubscribe() {
|
||||
let a = Node::new("test_node").await;
|
||||
|
||||
@ -26,7 +26,7 @@ async fn resubscribe_after_unsubscribe() {
|
||||
drop(a.pubsub_subscribe("topic".into()).await.unwrap());
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn unsubscribe_via_drop() {
|
||||
let a = Node::new("test_node").await;
|
||||
|
||||
@ -39,7 +39,7 @@ async fn unsubscribe_via_drop() {
|
||||
assert_eq!(a.pubsub_subscribed().await.unwrap(), empty);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn can_publish_without_subscribing() {
|
||||
let a = Node::new("test_node").await;
|
||||
a.pubsub_publish("topic".into(), b"foobar".to_vec())
|
||||
@ -47,7 +47,7 @@ async fn can_publish_without_subscribing() {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
#[allow(clippy::mutable_key_type)] // clippy doesn't like Vec inside HashSet
|
||||
async fn publish_between_two_nodes() {
|
||||
use futures::stream::StreamExt;
|
||||
@ -140,7 +140,7 @@ async fn publish_between_two_nodes() {
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "test_go_interop", feature = "test_js_interop"))]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
#[ignore = "doesn't work yet"]
|
||||
async fn pubsub_interop() {
|
||||
use common::interop::{api_call, ForeignNode};
|
||||
|
@ -51,7 +51,7 @@ async fn check_cid_subscriptions(ipfs: &Node, cid: &Cid, expected_count: usize)
|
||||
}
|
||||
|
||||
/// Check if canceling a Cid affects the wantlist.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
#[tokio::test]
|
||||
async fn wantlist_cancellation() {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user