Prove che cadevano con il runner carico (#46)
Le prove cadevano a ogni carico della CI, ogni volta prove diverse. Dietro alcune c'erano difetti veri: FebeDatabase lasciava i file aperti dopo DisposeAsync (comandi SQLite non chiusi, pool di lettura chiuso dopo lo scrittore), e il WAL spariva durante lo spostamento della cartella Dati; la scheda dell'account senza statistiche leggeva i file di tutta la libreria; l'arresto di FebeApp non aspettava i lavori aggiunti da un avvio in corso. Chromium ha 120 s per avviarsi e aprire la prima scheda, e il ricollegamento smette appena il processo cambia. Nelle prove i limiti di tempo diventano protezioni contro un blocco: attese per condizione con un aiuto comune, limiti per classe nella prova di scala con il tempo migliore, porta 0 e stderr di Chromium nel browser delle prove, e la prova di «Scollega» di WebView2 controlla che il processo esca davvero. Provato su Windows con tutti i core occupati. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e2e64c09e8
commit
0775a1460f
34 files changed
+875
-245
No files matched your search
@@ -99,22 +99,26 @@ public sealed class EngineMonitorTests
|
||||
{
|
||||
await using var bed = await EngineTestBed.CreateAsync();
|
||||
var host = bed.Start(new ScriptedRunner(bed.Governor, bed.Clock));
|
||||
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20));
|
||||
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
|
||||
var received = new List<EngineNotification>();
|
||||
var reading = Task.Run(async () =>
|
||||
{
|
||||
await foreach (var notification in host.Monitor.SubscribeAsync(cts.Token))
|
||||
{
|
||||
received.Add(notification);
|
||||
if (notification.Kind == EngineNotificationKind.Event && notification.Event!.Code == EngineEventCodes.Paused)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
await Task.Delay(100);
|
||||
|
||||
// Subscribed on this thread before the pause: the first MoveNextAsync runs up to its wait and registers the
|
||||
// subscriber, so no pool thread has to start in time for the event (#46).
|
||||
await using var stream = host.Monitor.SubscribeAsync(cts.Token).GetAsyncEnumerator(cts.Token);
|
||||
var next = stream.MoveNextAsync();
|
||||
await host.PauseAsync();
|
||||
await reading;
|
||||
while (await next)
|
||||
{
|
||||
var notification = stream.Current;
|
||||
received.Add(notification);
|
||||
if (notification.Kind == EngineNotificationKind.Event && notification.Event!.Code == EngineEventCodes.Paused)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
next = stream.MoveNextAsync();
|
||||
}
|
||||
|
||||
Assert.IsTrue(received.Any(n => n.Event?.Code == EngineEventCodes.Paused));
|
||||
StringAssert.Contains(received.Last().Event!.Message, "Riprendi");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user