Skip to content

Commit

Permalink
feat: fix Cluster config
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoxkang committed May 14, 2024
1 parent ed328b7 commit 0eb3b81
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/CAServer.Orleans.TestBase/ClusterFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,33 @@ public class ClusterFixture : IDisposable, ISingletonDependency
public ClusterFixture()
{
var builder = new TestClusterBuilder();
var randomPort = DateTime.UtcNow.Second * 1000 + DateTime.UtcNow.Millisecond;
builder.Options.BaseGatewayPort = 2000 + randomPort;
builder.Options.BaseSiloPort = 1000 + randomPort;
builder.Options.InitialSilosCount = 1;

builder.AddSiloBuilderConfigurator<TestSiloConfigurations>();
// builder.AddClientBuilderConfigurator<TestClientBuilderConfigurator>();
Cluster = builder.Build();
Cluster.Deploy();
var retryCount = 30;
while (true)
{
try
{
Cluster.Deploy();
break;
}
catch (Exception ex)
{
builder.Options.BaseGatewayPort++;
builder.Options.BaseSiloPort++;
Cluster = builder.Build();
if (retryCount-- <= 0)
{
throw;
}
}
}
}

public void Dispose()
Expand Down

0 comments on commit 0eb3b81

Please sign in to comment.