diff --git a/server/src/Vanguard.Server/Configuration/OrleansOptions.cs b/server/src/Vanguard.Server/Configuration/OrleansOptions.cs index 4f180de..aafed5e 100644 --- a/server/src/Vanguard.Server/Configuration/OrleansOptions.cs +++ b/server/src/Vanguard.Server/Configuration/OrleansOptions.cs @@ -10,4 +10,10 @@ public sealed class OrleansOptions public const string SectionName = "Orleans"; public bool Enabled { get; set; } + + /// Порт silo. По умолчанию стандартный Orleans 11111. + public int SiloPort { get; set; } = 11111; + + /// Порт gateway. По умолчанию стандартный Orleans 30000. + public int GatewayPort { get; set; } = 30000; } diff --git a/server/src/Vanguard.Server/Program.cs b/server/src/Vanguard.Server/Program.cs index 68d45fc..410f539 100644 --- a/server/src/Vanguard.Server/Program.cs +++ b/server/src/Vanguard.Server/Program.cs @@ -43,7 +43,7 @@ if (orleansOptions.Enabled) { // Один silo на инстанс сервера. Для нескольких реплик нужен настоящий // кластер (AdoNet/Redis clustering), но контракт грана уже готов. - silo.UseLocalhostClustering(); + silo.UseLocalhostClustering(orleansOptions.SiloPort, orleansOptions.GatewayPort); silo.Configure(options => options.CollectionAge = TimeSpan.FromHours(12)); }); diff --git a/server/tests/Vanguard.Server.Tests/OrleansServerE2ETests.cs b/server/tests/Vanguard.Server.Tests/OrleansServerE2ETests.cs index 38bd6b4..ce89a09 100644 --- a/server/tests/Vanguard.Server.Tests/OrleansServerE2ETests.cs +++ b/server/tests/Vanguard.Server.Tests/OrleansServerE2ETests.cs @@ -48,9 +48,16 @@ public class OrleansServerE2ETests Assert.True(health.GetProperty("matches").GetInt32() >= 1); } - private static WebApplicationFactory NewFactory() => - new WebApplicationFactory().WithWebHostBuilder(builder => - builder.UseSetting("Orleans:Enabled", "true")); + private static WebApplicationFactory NewFactory() + { + return new WebApplicationFactory().WithWebHostBuilder(builder => + { + builder.UseSetting("Orleans:Enabled", "true"); + // Не пересекаться с TestCluster из OrleansMatchTests. + builder.UseSetting("Orleans:SiloPort", "21111"); + builder.UseSetting("Orleans:GatewayPort", "21000"); + }); + } private static async Task EnqueueAsync( HttpClient http,