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
@@ -9,8 +9,22 @@ namespace Febe.Tests.Server.Support;
|
||||
internal sealed class FakeRemoteViewHost : IRemoteViewHost
|
||||
{
|
||||
private readonly Lock _gate = new();
|
||||
private readonly List<FakeRemoteViewConnection> _opened = [];
|
||||
|
||||
public List<FakeRemoteViewConnection> Opened { get; } = [];
|
||||
/// <summary>
|
||||
/// The views opened so far, copied under the lock the server writes with: the tests read it from their own thread
|
||||
/// while the server may be adding to it (#46).
|
||||
/// </summary>
|
||||
public IReadOnlyList<FakeRemoteViewConnection> Opened
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
return [.. _opened];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Unavailable { get; set; }
|
||||
|
||||
@@ -24,12 +38,12 @@ internal sealed class FakeRemoteViewHost : IRemoteViewHost
|
||||
var connection = new FakeRemoteViewConnection();
|
||||
lock (_gate)
|
||||
{
|
||||
if (Opened.LastOrDefault() is { Disposed: false } previous)
|
||||
if (_opened.LastOrDefault() is { Disposed: false } previous)
|
||||
{
|
||||
previous.End(RemoteViewEnd.Replaced);
|
||||
}
|
||||
|
||||
Opened.Add(connection);
|
||||
_opened.Add(connection);
|
||||
}
|
||||
|
||||
return Task.FromResult<IRemoteViewConnection>(connection);
|
||||
@@ -39,12 +53,24 @@ internal sealed class FakeRemoteViewHost : IRemoteViewHost
|
||||
internal sealed class FakeRemoteViewConnection : IRemoteViewConnection
|
||||
{
|
||||
private readonly Channel<RemoteViewOutput> _output = Channel.CreateUnbounded<RemoteViewOutput>();
|
||||
private volatile bool _disposed;
|
||||
private volatile object? _ended;
|
||||
|
||||
public ConcurrentQueue<object> Inputs { get; } = new();
|
||||
|
||||
public bool Disposed { get; private set; }
|
||||
/// <summary>Set by the server's thread, read by the test's: volatile.</summary>
|
||||
public bool Disposed
|
||||
{
|
||||
get => _disposed;
|
||||
private set => _disposed = value;
|
||||
}
|
||||
|
||||
public RemoteViewEnd? Ended
|
||||
{
|
||||
get => (RemoteViewEnd?)_ended;
|
||||
private set => _ended = value;
|
||||
}
|
||||
|
||||
public RemoteViewEnd? Ended { get; private set; }
|
||||
|
||||
public void Write(RemoteViewOutput output) => _output.Writer.TryWrite(output);
|
||||
|
||||
|
||||
Reference in new issue
Block a user