Prove che cadevano con il runner carico (#46)
verifica / controlli (push) Successful in 25s
verifica / prove (push) Successful in 25m9s
verifica / installatore (push) Successful in 7m37s
verifica / immagine (push) Successful in 20m21s

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:
Alby96andClaude Opus 5.5 committed 2026-11-13 19:50:40 +01:00
1 parent e2e64c09e8
commit 0775a1460f
34 files changed
+875 -245

No files matched your search

+15 -22
View File
@@ -37,7 +37,7 @@ public sealed partial class ServerEndToEndTests
}
[TestMethod]
[Timeout(360_000, CooperativeCancellation = true)]
[Timeout(540_000, CooperativeCancellation = true)]
public async Task TheRealServerCollectsFromTheTestSiteStopsAtTheVerificationAndShowsTheBrowser()
{
var ct = TestContext.CancellationToken;
@@ -46,7 +46,7 @@ public sealed partial class ServerEndToEndTests
await using var bed = await ServerTestBed.StartAsync(telegram: telegram, freeSpace: disk);
var server = bed.Server;
Assert.IsEmpty(server.Problems);
await server.Running.WaitAsync(TimeSpan.FromSeconds(60), ct);
await bed.WaitRunningAsync(ct);
var connection = server.Connection!;
// The health check answers without a session; everything else wants the password.
@@ -204,13 +204,13 @@ public sealed partial class ServerEndToEndTests
}
[TestMethod]
[Timeout(120_000, CooperativeCancellation = true)]
[Timeout(360_000, CooperativeCancellation = true)]
public async Task FinishWithoutSessionSaysSoAndDisconnectDeletesTheProfile()
{
var ct = TestContext.CancellationToken;
await using var bed = await ServerTestBed.StartAsync(autoLogin: true);
var server = bed.Server;
await server.Running.WaitAsync(TimeSpan.FromSeconds(60), ct);
await bed.WaitRunningAsync(ct);
var connection = server.Connection!;
Assert.AreEqual(ConnectionState.Connected, (await connection.GetStatusAsync(ct)).State, "the test site's automatic login");
@@ -222,7 +222,10 @@ public sealed partial class ServerEndToEndTests
Assert.IsTrue(server.Browser.IsAvailable, "the browser runs again, with an empty profile");
Assert.AreEqual(ConnectionState.NotConnected, (await connection.GetStatusAsync(ct)).State);
Assert.IsFalse(server.Browser.UserIsDriving);
Assert.IsTrue(server.Engine!.Services.Runtime.IsRunning || await WaitRunningAsync(server), "the engine loop runs again (and waits for a connection)");
await ServerTestBed.WaitUntilAsync(
() => Task.FromResult(server.Engine!.Services.Runtime.IsRunning),
TimeSpan.FromSeconds(60),
"il motore di nuovo in funzione, in attesa del collegamento");
// «Ho finito» without having logged in: Febe says it does not find the session.
await connection.BeginUserDrivingAsync(openLogin: false, ct);
@@ -243,13 +246,13 @@ public sealed partial class ServerEndToEndTests
}
[TestMethod]
[Timeout(120_000, CooperativeCancellation = true)]
[Timeout(420_000, CooperativeCancellation = true)]
public async Task TwoViewsOpenedAtTheSameMomentLeaveOneViewWithItsFramesAndOneLease()
{
var ct = TestContext.CancellationToken;
await using var bed = await ServerTestBed.StartAsync();
var server = bed.Server;
await server.Running.WaitAsync(TimeSpan.FromSeconds(60), ct);
await bed.WaitRunningAsync(ct);
var host = server.RemoteView!;
var gate = server.Browser!.UserDriving;
var released = 0;
@@ -268,7 +271,7 @@ public sealed partial class ServerEndToEndTests
// «about:blank» here means the engine's rest has committed.
await ServerTestBed.WaitUntilAsync(
async () => await Febe.Browser.Cdp.CdpPageExtensions.GetMainFrameUrlAsync(server.Browser.Cdp, ct) == "about:blank",
TimeSpan.FromSeconds(20),
TimeSpan.FromSeconds(60),
"la pagina di riposo");
// Two tabs restored together, or the phone and the PC at once: the newest wins, the other is ended — and the
@@ -302,13 +305,13 @@ public sealed partial class ServerEndToEndTests
}
[TestMethod]
[Timeout(180_000, CooperativeCancellation = true)]
[Timeout(480_000, CooperativeCancellation = true)]
public async Task AViewOpenedWhileThePageIsNavigatingOpensAndShowsItsFrames()
{
var ct = TestContext.CancellationToken;
await using var bed = await ServerTestBed.StartAsync();
var server = bed.Server;
await server.Running.WaitAsync(TimeSpan.FromSeconds(60), ct);
await bed.WaitRunningAsync(ct);
var host = server.RemoteView!;
var browser = server.Browser!;
@@ -318,7 +321,7 @@ public sealed partial class ServerEndToEndTests
// engine's rest after the last view has committed and nothing else navigates.
await ServerTestBed.WaitUntilAsync(
async () => await Febe.Browser.Cdp.CdpPageExtensions.GetMainFrameUrlAsync(browser.Cdp, ct) == "about:blank",
TimeSpan.FromSeconds(20),
TimeSpan.FromSeconds(60),
"la pagina di riposo");
// Even rounds: «Accedi a Instagram» on the Collegamento page navigates to the login page while the same page
@@ -353,7 +356,7 @@ public sealed partial class ServerEndToEndTests
private static async Task<bool> FrameArrivesAsync(IRemoteViewConnection view, CancellationToken ct)
{
using var timeout = CancellationTokenSource.CreateLinkedTokenSource(ct);
timeout.CancelAfter(TimeSpan.FromSeconds(15));
timeout.CancelAfter(TimeSpan.FromSeconds(60)); // only a hang guard: it returns at the first frame
try
{
await foreach (var output in view.ReadAsync(timeout.Token))
@@ -371,16 +374,6 @@ public sealed partial class ServerEndToEndTests
return false;
}
private static async Task<bool> WaitRunningAsync(Febe.Server.FebeServer server)
{
for (var i = 0; i < 40 && !server.Engine!.Services.Runtime.IsRunning; i++)
{
await Task.Delay(100);
}
return server.Engine!.Services.Runtime.IsRunning;
}
private static async Task<List<(Entry Entry, Media Media)>> StoredAsync(Febe.Server.FebeServer server, long accountId, CancellationToken ct)
{
var list = new List<(Entry, Media)>();