Give test databases a longer PostgreSQL connect timeout (refs #20 #25)
ci / test (postgres) (push) Successful in 2m37s
ci / test (sqlite) (push) Successful in 2m4s
ci / test (postgres) (pull_request) Successful in 3m17s
ci / test (sqlite) (pull_request) Successful in 2m22s
ci / image (push) Successful in 35s
ci / image (pull_request) Successful in 11s

On the CI runner twelve test workers open PostgreSQL connections at once
and some waited longer than the application's 5 seconds, failing two
collector tests with a connection timeout that has nothing to do with
the code under test. The connect timeout is now a DbSettings field that
keeps the 5-second default for the application, and the test databases
ask for 30 seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-10 17:40:12 +01:00
1 parent 094a527ba2
commit 1a8d48212f
3 files changed
+10 -3

No files matched your search

+1 -1
View File
@@ -79,7 +79,7 @@ public sealed class Database : IAsyncDisposable
Username = settings.User,
Password = settings.Password,
};
pg.Timeout = 5;
pg.Timeout = settings.ConnectTimeoutSeconds;
pg.CommandTimeout = 60;
pg.ApplicationName = "anubis";
var dataSource = new NpgsqlDataSourceBuilder(pg.ToString()).Build();
+3
View File
@@ -33,6 +33,9 @@ public sealed record DbSettings
/// <summary>A full PostgreSQL address (<c>ANUBIS_DB_URL</c>) that replaces the five fields.</summary>
public string? Url { get; init; }
/// <summary>Seconds to wait for a new PostgreSQL connection. Short, so a lost server shows quickly; tests raise it.</summary>
public int ConnectTimeoutSeconds { get; init; } = 5;
/// <summary>What the interface shows: engine and place, never the password.</summary>
public string Describe() => Engine switch
{