Merge remote-tracking branch 'origin/main' into correzione/prova-da-capo-a-fondo
Revisione: la causa è l'orologio che somma le attese, e «Controlla ora» si chiede di nuovo prima di aspettare la verifica, perché a sessione finita la pausa può arrivare a 90 minuti. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
4dc3a83a51
9 files changed
+125
-18
No files matched your search
@@ -86,12 +86,7 @@ public sealed partial class ServerEndToEndTests
|
||||
Assert.AreEqual(ConnectionState.Connected, (await connection.GetStatusAsync(ct)).State);
|
||||
|
||||
// «Controlla ora».
|
||||
var check = await bed.JsonAsync(HttpMethod.Post, $"/api/accounts/{marta.Id}/check-now");
|
||||
if (check.GetProperty("status").GetString() == "needsConfirmation")
|
||||
{
|
||||
check = await bed.JsonAsync(HttpMethod.Post, $"/api/accounts/{marta.Id}/check-now", $$"""{"token":"{{check.GetProperty("token").GetString()}}"}""");
|
||||
}
|
||||
|
||||
var check = await CheckNowAsync(bed, marta.Id);
|
||||
Assert.AreEqual("queued", check.GetProperty("status").GetString(), check.GetProperty("message").GetString());
|
||||
|
||||
// The engine runs a session: every action toward the site has its Governor's permit in action_log.
|
||||
@@ -103,9 +98,8 @@ public sealed partial class ServerEndToEndTests
|
||||
Assert.IsTrue(actions.All(a => a.SessionId is not null), "every counted action belongs to a session");
|
||||
Assert.IsNotNull(await server.Database.Sessions.GetLastAsync(ct));
|
||||
|
||||
// The session is the one Alberto asked for, and starts from his account. Another account first (a session of the
|
||||
// engine's own that began at «Ho finito») leaves little of these few minutes to marta.prova, and once they end the
|
||||
// files have to wait for the next session: say it here, not after a wait that cannot succeed.
|
||||
// The session is the one Alberto asked for, and starts from the account he chose: not a session of the engine's
|
||||
// own that began at «Ho finito», before his request.
|
||||
if (actions.First(a => a.AccountId is not null).AccountId != marta.Id)
|
||||
{
|
||||
Assert.Fail($"La prima azione della sessione non è su marta.prova, chiesta con «Controlla ora».\n{await bed.DescribeAsync()}");
|
||||
@@ -141,8 +135,9 @@ public sealed partial class ServerEndToEndTests
|
||||
TestContext.WriteLine($"Ricette: {string.Join(", ", recipes.Select(r => r.Code).Distinct())}; file di marta.prova: {stored.Count}.");
|
||||
|
||||
// The site asks for a verification: at its next action toward the site the engine stops and the banner appears
|
||||
// in /api/engine. Usually still in the first session (two accounts to read in full); if that session already
|
||||
// ended, in the next one, after the minimum pause (20 minutes at 5×: four real minutes).
|
||||
// in /api/engine. Usually still in the first session (two accounts to read in full). Were that session over, or
|
||||
// ending right now, the next one would come 20 to 90 minutes later (4 to 18 real ones at 5×): «Controlla ora» again
|
||||
// brings it to the minimum pause, four real minutes.
|
||||
// Alerts on Telegram (M8): token and chat set from Impostazioni ▸ Notifiche; the composition sends through the fake.
|
||||
const string token = "4839574812:AAF-gettoneDelServerDiProva_123";
|
||||
var events = """{"verification":true,"disconnection":true,"throttle":true,"backfillDone":true,"diskLow":true,"unknownFormat":true}""";
|
||||
@@ -150,6 +145,7 @@ public sealed partial class ServerEndToEndTests
|
||||
|
||||
var servedBefore = bed.Site.Control.CdnFilesServed;
|
||||
bed.Site.Control.Set(StopMode.Challenge);
|
||||
await CheckNowAsync(bed, marta.Id);
|
||||
await bed.WaitUntilAsync(
|
||||
async () =>
|
||||
{
|
||||
@@ -385,6 +381,16 @@ public sealed partial class ServerEndToEndTests
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>«Controlla ora», confirmed when Febe asks for it.</summary>
|
||||
private static async Task<JsonElement> CheckNowAsync(ServerTestBed bed, long accountId)
|
||||
{
|
||||
var path = $"/api/accounts/{accountId}/check-now";
|
||||
var check = await bed.JsonAsync(HttpMethod.Post, path);
|
||||
return check.GetProperty("status").GetString() == "needsConfirmation"
|
||||
? await bed.JsonAsync(HttpMethod.Post, path, $$"""{"token":"{{check.GetProperty("token").GetString()}}"}""")
|
||||
: check;
|
||||
}
|
||||
|
||||
private static async Task<List<(Entry Entry, Media Media)>> StoredAsync(Febe.Server.FebeServer server, long accountId, CancellationToken ct)
|
||||
{
|
||||
var list = new List<(Entry, Media)>();
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace Febe.Tests.Server.Support;
|
||||
/// in a temporary Data/Library/Import folder, on free ports and a free display. Never Instagram: the browser only ever
|
||||
/// sees 127.0.0.1. Time runs five times faster (<see cref="ScaledClock"/>) in a time zone where it is around noon now, so
|
||||
/// that the engine is inside its active window whatever the hour of the test. Five and not more: the engine's few minutes
|
||||
/// and pauses stay short, and the limits of a real page (30 seconds to load, 20 for its data) stay seconds on a loaded
|
||||
/// runner.
|
||||
/// and pauses stay short, and the limits of a real page (30 seconds to load, 20 for its data) are six and four real
|
||||
/// seconds.
|
||||
/// </summary>
|
||||
internal sealed class ServerTestBed : IAsyncDisposable
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user