Skip to content

Commit

Permalink
RavenDB-22652 : inter-version tests - add retry mechanism for adding …
Browse files Browse the repository at this point in the history
…nodes to cluster, in order to avoid test failures due to NoLeaderException
  • Loading branch information
aviv committed Aug 15, 2024
1 parent ceb5e9c commit c815463
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/InterversionTests/MixedClusterTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,25 @@ protected async Task<List<ProcessNode>> CreateCluster(string[] peers, X509Certif
if (processNode == leader)
continue;

var addCommand = new AddClusterNodeCommand(processNode.Url, watcher: watcherCluster);
await requestExecutor.ExecuteAsync(addCommand, context);
int retries = 5;
while (true)
{
try
{
var addCommand = new AddClusterNodeCommand(processNode.Url, watcher: watcherCluster);
await requestExecutor.ExecuteAsync(addCommand, context);
}
catch (Exception e)
{
if (--retries == 0)
throw new InvalidOperationException($"failed to add node '{processNode.Url}' to the cluster", e);

await Task.Delay(10);
continue;
}

break;
}
}

var result = watcherCluster ? (1, peers.Length - 1) : (peers.Length, 0);
Expand Down

0 comments on commit c815463

Please sign in to comment.