Add a network proof of the real daily history (refs #18 #21)

A LiveDemo test, outside the normal suite, that downloads the whole OKX EUR
daily history of BTC, ETH and SOL and the Binance BTCUSDT archives since 2017,
then writes the quality report. It is the evidence for the phase criteria that
a fake network cannot give.

The detached database test now retries the file move for a few seconds:
Windows refuses to move the SQLite file while a request of the running server
holds it, which made the test fail now and then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-10 15:51:37 +01:00
1 parent 4a65d4060f
commit aa2766f3ed
2 files changed
+93 -2

No files matched your search

+22 -2
View File
@@ -244,8 +244,7 @@ public sealed class ServerTests
var file = new DataDirectory(server.DataDir).SqliteFile;
var away = file + ".altrove";
Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools();
File.Move(file, away);
await MoveWhenFreeAsync(file, away);
await server.WaitForAsync(HostMode.DatabaseUnavailable);
using (var page = await server.GetAsync("/"))
@@ -262,6 +261,27 @@ public sealed class ServerTests
Assert.AreEqual(HttpStatusCode.OK, back.StatusCode, "Same session, no restart.");
}
/// <summary>
/// Moves the database file as soon as no connection holds it: a request or a background job of the running server
/// can have one open for a moment, and Windows refuses to move an open file.
/// </summary>
private static async Task MoveWhenFreeAsync(string from, string to)
{
for (var attempt = 1; ; attempt++)
{
Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools();
try
{
File.Move(from, to);
return;
}
catch (IOException) when (attempt < 50)
{
await Task.Delay(100);
}
}
}
[TestMethod]
public async Task EmptyDatabaseOfAKnownInstallationAsksTheUser()
{