Skip to content

Commit

Permalink
fixup: enable more docs in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Sep 25, 2024
1 parent 4a3caff commit d073f0c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
24 changes: 20 additions & 4 deletions iroh/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,11 @@ mod tests {
iroh.shutdown().await?;
}

let iroh = Node::persistent(iroh_root.path()).await?.spawn().await?;
let iroh = Node::persistent(iroh_root.path())
.await?
.enable_docs()
.spawn()
.await?;
let _doc = iroh.docs().create().await?;

Ok(())
Expand Down Expand Up @@ -796,6 +800,7 @@ mod tests {
let iroh = Node::persistent(iroh_root)
.await
.unwrap()
.enable_docs()
.spawn()
.await
.unwrap();
Expand All @@ -816,8 +821,12 @@ mod tests {
docs_store.delete_author(default_author).unwrap();
docs_store.flush().unwrap();
drop(docs_store);
let iroh = Node::persistent(iroh_root).await.unwrap().spawn().await;
dbg!(&iroh);
let iroh = Node::persistent(iroh_root)
.await
.unwrap()
.enable_docs()
.spawn()
.await;
assert!(iroh.is_err());

// somehow the blob store is not shutdown correctly (yet?) on macos.
Expand All @@ -829,7 +838,12 @@ mod tests {
.await
.unwrap();
drop(iroh);
let iroh = Node::persistent(iroh_root).await.unwrap().spawn().await;
let iroh = Node::persistent(iroh_root)
.await
.unwrap()
.enable_docs()
.spawn()
.await;
assert!(iroh.is_ok());
iroh.unwrap().shutdown().await.unwrap();
}
Expand All @@ -839,6 +853,7 @@ mod tests {
let iroh = Node::persistent(iroh_root)
.await
.unwrap()
.enable_docs()
.spawn()
.await
.unwrap();
Expand All @@ -852,6 +867,7 @@ mod tests {
let iroh = Node::persistent(iroh_root)
.await
.unwrap()
.enable_docs()
.spawn()
.await
.unwrap();
Expand Down
8 changes: 8 additions & 0 deletions iroh/tests/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const TIMEOUT: Duration = Duration::from_secs(60);
fn test_node(secret_key: SecretKey) -> Builder<iroh_blobs::store::mem::Store> {
Node::memory()
.secret_key(secret_key)
.enable_docs()
.relay_mode(RelayMode::Disabled)
}

Expand Down Expand Up @@ -493,13 +494,15 @@ async fn test_sync_via_relay() -> Result<()> {
let node1 = Node::memory()
.relay_mode(RelayMode::Custom(relay_map.clone()))
.insecure_skip_relay_cert_verify(true)
.enable_docs()
.spawn()
.await?;
let node1_id = node1.node_id();
let node2 = Node::memory()
.bind_random_port()
.relay_mode(RelayMode::Custom(relay_map.clone()))
.insecure_skip_relay_cert_verify(true)
.enable_docs()
.spawn()
.await?;

Expand Down Expand Up @@ -593,6 +596,7 @@ async fn sync_restart_node() -> Result<()> {
.relay_mode(RelayMode::Custom(relay_map.clone()))
.dns_resolver(discovery_server.dns_resolver())
.node_discovery(discovery_server.discovery(secret_key_1.clone()).into())
.enable_docs()
.spawn()
.await?;
let id1 = node1.node_id();
Expand All @@ -612,6 +616,7 @@ async fn sync_restart_node() -> Result<()> {
.insecure_skip_relay_cert_verify(true)
.dns_resolver(discovery_server.dns_resolver())
.node_discovery(discovery_server.discovery(secret_key_2.clone()).into())
.enable_docs()
.spawn()
.await?;
let id2 = node2.node_id();
Expand Down Expand Up @@ -658,6 +663,7 @@ async fn sync_restart_node() -> Result<()> {
.relay_mode(RelayMode::Custom(relay_map.clone()))
.dns_resolver(discovery_server.dns_resolver())
.node_discovery(discovery_server.discovery(secret_key_1.clone()).into())
.enable_docs()
.spawn()
.await?;
assert_eq!(id1, node1.node_id());
Expand Down Expand Up @@ -979,6 +985,7 @@ async fn test_list_docs_stream() -> Result<()> {
let node = Node::memory()
.node_discovery(iroh::node::DiscoveryConfig::None)
.relay_mode(iroh::net::relay::RelayMode::Disabled)
.enable_docs()
.spawn()
.await?;
let count = 200;
Expand Down Expand Up @@ -1148,6 +1155,7 @@ impl PartialEq<ExpectedEntry> for (Entry, Bytes) {
async fn doc_delete() -> Result<()> {
let node = Node::memory()
.gc_policy(iroh::node::GcPolicy::Interval(Duration::from_millis(100)))
.enable_docs()
.spawn()
.await?;
let client = node.client();
Expand Down

0 comments on commit d073f0c

Please sign in to comment.