2 Commits
Author SHA1 Message Date
Alby96andClaude Opus 5.5 e8b3500db6 Keep the test databases of the CI in memory
ci / test (postgres) (push) Successful in 6m54s
ci / test (sqlite) (push) Successful in 5m17s
ci / test (postgres) (pull_request) Successful in 6m51s
ci / test (sqlite) (pull_request) Successful in 7m17s
ci / image (push) Successful in 1m0s
ci / image (pull_request) Successful in 1m40s
The disk of the runner stops for seconds under load, and the health check of a
test rightly answered "unavailable" after five. PostgreSQL was already spared
the syncs (ADR 0015); the SQLite tests now use a temporary folder in memory, and
the health test looks at the answer it settles on (ADR 0019).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:31:13 +01:00
Alby96 3da9b00f44 Merge pull request 'Fase 8 — Apprendimento' (#109) from fase-8 into main
ci / test (postgres) (push) Successful in 5m53s
ci / test (sqlite) (push) Successful in 8m3s
ci / image (push) Successful in 47s
2026-12-01 16:58:03 +01:00
3 changed files with 42 additions and 3 deletions

No files matched your search

+5 -1
View File
@@ -12,6 +12,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: mcr.microsoft.com/dotnet/sdk:10.0 image: mcr.microsoft.com/dotnet/sdk:10.0
# The databases of the tests live in memory: the disk of the runner stops for seconds under load (ADR 0019).
options: --tmpfs /test-tmp:size=4g
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -50,7 +52,9 @@ jobs:
git -c http.extraHeader="Authorization: token ${{ github.token }}" fetch -q --depth 1 origin "${{ github.sha }}" git -c http.extraHeader="Authorization: token ${{ github.token }}" fetch -q --depth 1 origin "${{ github.sha }}"
git checkout -q FETCH_HEAD git checkout -q FETCH_HEAD
- name: Check - name: Check
run: sh ./tasks.sh check run: |
df -h /test-tmp
TMPDIR=/test-tmp sh ./tasks.sh check
# The log of the PostgreSQL service, read through the Docker socket the runner mounts in the job (issue #98). # The log of the PostgreSQL service, read through the Docker socket the runner mounts in the job (issue #98).
- name: PostgreSQL log - name: PostgreSQL log
if: always() && matrix.db == 'postgres' if: always() && matrix.db == 'postgres'
+26
View File
@@ -0,0 +1,26 @@
# 0019 — Nella CI i database SQLite delle prove stanno in memoria
Data: 2026-12-01 · Stato: accettata · Continua l'ADR 0015 (CI, SPEC 15.5), senza componenti esterni nuovi
## Contesto
Il 1° dicembre 2026 la CI di `main` (run 557, lavoro `test (sqlite)`) è fallita in `HealthChecksDatabaseAndScheduler`: `/health` ha risposto 503. Il registro mostra che per oltre 6 secondi nessun test è avanzato, e il ping al database ha superato il suo limite di 5 secondi. Lo stesso codice era passato sul branch e nel lavoro PostgreSQL.
È la causa già vista nell'ADR 0015: il disco dell'esecutore su Unraid si ferma per secondi sotto carico. Lì il rimedio riguardava solo PostgreSQL. I database SQLite dei test sincronizzano ogni scrittura (`synchronous=FULL`, come dal vivo), e la Fase 8 ne ha aggiunti molti.
## Decisione
1. **Cartella temporanea in memoria.** Il contenitore del lavoro `test` monta un `tmpfs` da 4 GB al massimo in `/test-tmp`, e le prove la usano come cartella temporanea (`TMPDIR`). Il codice di Anubis e le impostazioni di SQLite restano quelli veri.
2. **Il test di `/health` aspetta.** Un computer fermo da più di 5 secondi *deve* risultare non disponibile: il test guarda la risposta a cui si arriva entro 30 secondi. Uno scheduler o un database davvero fermi lo fanno fallire ancora, e il messaggio dice quale.
## Alternative scartate
- `synchronous=OFF` nei test: cambierebbe il codice che si prova.
- Rilanciare il lavoro: nasconde la causa.
- Meno test in parallelo: la CI durerebbe di più e il disco si fermerebbe lo stesso.
## Conseguenze
- I test SQLite della CI non provano la durata dei dati dopo un'interruzione di corrente: non lo facevano nemmeno prima.
- In locale non cambia niente.
- Il passo `Check` stampa lo spazio della cartella: se il montaggio sparisse si vedrebbe lì.
+11 -2
View File
@@ -439,8 +439,17 @@ public sealed class ServerTests
var (env, postgres) = await ServerHarness.DockerOnEngineAsync(); var (env, postgres) = await ServerHarness.DockerOnEngineAsync();
await using var engine = postgres; await using var engine = postgres;
await using var server = await ServerHarness.StartAsync("docker", env); await using var server = await ServerHarness.StartAsync("docker", env);
var health = await server.Http.GetFromJsonAsync<HealthResponse>(new Uri("/health", UriKind.Relative));
Assert.AreEqual("ok", health!.Status); // A computer stopped for more than the five seconds of the check is told unhealthy, as it should: here the
// answer that counts is the one it settles on, within thirty seconds.
HealthResponse? health = null;
for (var watch = System.Diagnostics.Stopwatch.StartNew(); health?.Status != "ok" && watch.Elapsed < TimeSpan.FromSeconds(30); await Task.Delay(100))
{
using var response = await server.GetAsync("/health");
health = await response.Content.ReadFromJsonAsync<HealthResponse>();
}
Assert.AreEqual("ok", health!.Status, string.Join(", ", health.Checks!.Select(c => c.Key + " " + c.Value)));
Assert.AreEqual("ok", health.Checks!["database"]); Assert.AreEqual("ok", health.Checks!["database"]);
Assert.AreEqual("ok", health.Checks["scheduler"]); Assert.AreEqual("ok", health.Checks["scheduler"]);
} }