diff --git a/tests/Titano.Server.Tests/Api/AdminTests.cs b/tests/Titano.Server.Tests/Api/AdminTests.cs index 3de0b7fe..4553a203 100644 --- a/tests/Titano.Server.Tests/Api/AdminTests.cs +++ b/tests/Titano.Server.Tests/Api/AdminTests.cs @@ -76,13 +76,21 @@ public sealed class AdminTests(TestContext context) var admin = await server.AdminAsync(); using var files = await admin.GetAsync("/api/v1/logs/files"); var name = (await files.ReadAsync(ProtocolJson.Default.ListLogFileDto)).First().Name; - // Jobs, uploads and sign-ins keep writing to the file an administrator downloads. Only to the file: a flood on - // the console would hold up the loggers of the tests running alongside. + // Jobs, uploads and sign-ins keep writing to the file an administrator downloads: a log of a few megabytes takes + // a while to send, and a line lands about every millisecond meanwhile. Only to the file and never in a tight loop: + // engine code of every test server in this process logs through the last one started, so this server's console + // and file lock are shared with the tests running alongside. var logger = server.Services.GetServices().OfType().Single().CreateLogger("Titano.Server.Tests"); + var block = new string('x', 64 * 1024); + for (var i = 0; i < 32; i++) logger.LogInformation("{Block}", block); using var stop = new CancellationTokenSource(); var logging = Task.Factory.StartNew(() => { - while (!stop.IsCancellationRequested) logger.LogInformation("Busy"); + while (!stop.IsCancellationRequested) + { + logger.LogInformation("Busy"); + Thread.Sleep(1); + } }, TaskCreationOptions.LongRunning); try {