From 6e08f0be593cdea9b37799bad48207e0eb1ee8d6 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 28 Mar 2023 10:49:40 +0100 Subject: [PATCH] node: enable test_fetch_trusted_remotes With the latest fetch updates, the test for fetching trusted remotes can be enabled. The caveat is that its expected behaviour is to fetch the delegate upon a clone and fetch all trusted peers on a subsequent fetch. Fetching all trusted peers is left as a follow-up task. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-node/src/tests/e2e.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/radicle-node/src/tests/e2e.rs b/radicle-node/src/tests/e2e.rs index d96019ec..2ab3853c 100644 --- a/radicle-node/src/tests/e2e.rs +++ b/radicle-node/src/tests/e2e.rs @@ -223,7 +223,6 @@ fn test_dont_fetch_owned_refs() { } #[test] -#[ignore = "failing"] fn test_fetch_trusted_remotes() { logger::init(log::Level::Debug); @@ -272,8 +271,22 @@ fn test_fetch_trusted_remotes() { .unwrap() .collect::, _>>() .unwrap(); - // TODO: This fails because we are fetching all namespaces at the moment. - assert_eq!(bob_remotes.len(), trusted.len() + 1); + assert_eq!(bob_remotes, Some(alice.id).into_iter().collect()); + + // TODO(finto): we have to fetch again to get the other trusted remotes. + // At the moment, the existing Namespaces enum does not allow us + // to pass on what nodes are tracked, if there is no existing + // repository. Thus, the first fetch only attempts to clone the + // delegate. + bob.handle.fetch(acme, alice.id).unwrap(); + assert!(result.is_success()); + let bob_remotes = bob_repo + .remote_ids() + .unwrap() + .collect::, _>>() + .unwrap(); + + assert!(bob_remotes.len() == trusted.len() + 1); assert!(bob_remotes.is_superset(&trusted)); assert!(bob_remotes.contains(&alice.id)); }