From 76c969c7557c7b99e2a4e79b058856118ff30a05 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Fri, 8 Dec 2023 15:47:30 +0000 Subject: [PATCH] node: relax converge criteria Some test flakes would occur due to the `converge` function looping forever. It was noticed that in these cases the log output would look like: test: Node z6MkqTKLVnFdVF24PQiDoQffbTPT7U5igghS3XWuFJLfah1P has {(Id(rad:z39WuDs9hrqmCr9shjoz6dn2Abqyz), PublicKey(z6MkemMxfWhRQFKy4UPX7FsN8GjLAZ9T65rbmDsUn7fchioP)), (Id(rad:z39WuDs9hrqmCr9shjoz6dn2Abqyz), PublicKey(z6MkpdPJp7naAurUjCpwef1BDD5jfPhAvwfinaGd7pVh227j)), (Id(rad:z39WuDs9hrqmCr9shjoz6dn2Abqyz), PublicKey(z6MkqTKLVnFdVF24PQiDoQffbTPT7U5igghS3XWuFJLfah1P))} with further investigation, the variable `all_routes` was found to be smaller than the calculated routes. Instead of checking `==`, instead check that `routes.is_superset(&all_routes)`, which means that `routes` must be equal to `all_routes`, but allows it have extra entries. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-node/src/test/environment.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radicle-node/src/test/environment.rs b/radicle-node/src/test/environment.rs index 6f6be171..283afa71 100644 --- a/radicle-node/src/test/environment.rs +++ b/radicle-node/src/test/environment.rs @@ -511,11 +511,12 @@ pub fn converge<'a, G: Signer + cyphernet::Ecdh + 'static>( let routing = node.routing(); let routes = BTreeSet::from_iter(routing); - if routes == all_routes { + if routes.is_superset(&all_routes) { log::debug!(target: "test", "Node {} has converged", node.id); return false; } else { log::debug!(target: "test", "Node {} has {:?}", node.id, routes); + log::debug!(target: "test", "All routes {:?}", all_routes); } true });