From a5749824fbbd6fb97f3493fcf91dfb8d47edd52f Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 8 Sep 2023 15:43:10 +0200 Subject: [PATCH] Update to full connectivity helper --- .../Helpers/FullConnectivityHelper.cs | 32 ++++--------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/DistTestCore/Helpers/FullConnectivityHelper.cs b/DistTestCore/Helpers/FullConnectivityHelper.cs index 68dfdbb..b69af0c 100644 --- a/DistTestCore/Helpers/FullConnectivityHelper.cs +++ b/DistTestCore/Helpers/FullConnectivityHelper.cs @@ -1,7 +1,6 @@ using DistTestCore.Codex; using Logging; using NUnit.Framework; -using Utils; namespace DistTestCore.Helpers { @@ -35,10 +34,9 @@ namespace DistTestCore.Helpers var entries = CreateEntries(nodes); var pairs = CreatePairs(entries); - RetryWhilePairs(pairs, () => - { - CheckAndRemoveSuccessful(pairs); - }); + // Each pair gets two chances. + CheckAndRemoveSuccessful(pairs); + CheckAndRemoveSuccessful(pairs); if (pairs.Any()) { @@ -54,35 +52,19 @@ namespace DistTestCore.Helpers } } - private static void RetryWhilePairs(List pairs, Action action) - { - var timeout = DateTime.UtcNow + TimeSpan.FromMinutes(2); - while (pairs.Any(p => p.Inconclusive) && timeout > DateTime.UtcNow) - { - action(); - - Time.Sleep(TimeSpan.FromSeconds(2)); - } - } - private void CheckAndRemoveSuccessful(List pairs) { - // For large sets, don't try and do all of them at once. - var selectedPair = pairs.Take(20).ToArray(); - var pairDetails = new List(); - - foreach (var pair in selectedPair) + var results = new List(); + foreach (var pair in pairs.ToArray()) { pair.Check(); - if (pair.Success) { - pairDetails.AddRange(pair.GetResultMessages()); + results.AddRange(pair.GetResultMessages()); pairs.Remove(pair); } } - - Log($"Connections successful:{Nl}{string.Join(Nl, pairDetails)}"); + Log($"Connections successful:{Nl}{string.Join(Nl, results)}"); } private Entry[] CreateEntries(CodexAccess[] nodes)