public async Task AuditorRestartTest() { var environment = new IntegrationTestEnvironment(); await environment.PrepareConstellation(3, 0); var auditorStartup = environment.AuditorWrappers.First(); await auditorStartup.Shutdown(); Assert.AreEqual(2, ((AlphaStateManager)environment.AlphaWrapper.Context.AppState).ConnectedAuditorsCount, "Auditors count assertion."); await environment.AssertConstellationState(ApplicationState.Ready, TimeSpan.FromSeconds(10)); var clientsCount = 100; environment.GenerateCliens(clientsCount); await environment.AssertClientsCount(clientsCount, TimeSpan.FromSeconds(15)); await auditorStartup.Run(); await IntegrationTestEnvironmentExtensions.AssertState(auditorStartup.Startup, ApplicationState.Ready, TimeSpan.FromSeconds(10)); await IntegrationTestEnvironmentExtensions.AssertDuringPeriod( () => Task.FromResult(auditorStartup.Context.QuantumStorage.CurrentApex == environment.AlphaWrapper.Context.QuantumStorage.CurrentApex), TimeSpan.FromSeconds(5), "Apexes are not equal" ); }
public static async Task PrepareConstellation(this IntegrationTestEnvironment environment, int auditorsCount, int clientsCount) { environment.Init(auditorsCount); await environment.RunAlpha(); await environment.InitConstellation(); await environment.AssertConstellationState(ApplicationState.Running, TimeSpan.FromSeconds(5)); await environment.RunAuditors(); await environment.AssertConstellationState(ApplicationState.Ready, TimeSpan.FromSeconds(50 * auditorsCount)); environment.GenerateCliens(clientsCount); await environment.AssertClientsCount(clientsCount, TimeSpan.FromSeconds(15)); }