Merge main into fase-9: SQLite test databases in memory on the CI
ci / test (postgres) (push) Failing after 6m53s
ci / test (sqlite) (push) Failing after 5m26s
ci / image (push) Skipped
ci / test (postgres) (pull_request) Failing after 7m47s
ci / test (sqlite) (pull_request) Canceled after 1m49s
ci / image (pull_request) Canceled after 0s
ci / test (postgres) (push) Failing after 6m53s
ci / test (sqlite) (push) Failing after 5m26s
ci / image (push) Skipped
ci / test (postgres) (pull_request) Failing after 7m47s
ci / test (sqlite) (pull_request) Canceled after 1m49s
ci / image (pull_request) Canceled after 0s
The CI of Phase 9 failed on seven tests that start the server on a SQLite file: on the runner's disk the migrations alone took 24 seconds, past the 30-second start limit. PR #110 (ADR 0019), now in main, keeps the test databases in a tmpfs folder on the CI. STATE.md no longer lists #110 as waiting for the user. refs #75 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
4aea2d0be7
4 files changed
+43
-4
No files matched your search
@@ -13,6 +13,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:
|
||||||
@@ -56,7 +58,9 @@ jobs:
|
|||||||
git fetch -q --depth 1 origin "${{ github.sha }}"
|
git 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'
|
||||||
|
|||||||
+1
-1
@@ -184,6 +184,7 @@ Nulla.
|
|||||||
- Nella modalità dimostrativa il Laboratorio è spento: mostra l'elenco ma non esegue prove.
|
- Nella modalità dimostrativa il Laboratorio è spento: mostra l'elenco ma non esegue prove.
|
||||||
- I dati di mercato si spengono con `ANUBIS_MARKET_DATA=off`; nella modalità dimostrativa sono sempre spenti.
|
- I dati di mercato si spengono con `ANUBIS_MARKET_DATA=off`; nella modalità dimostrativa sono sempre spenti.
|
||||||
- Gli universi passati usano i flag ETF e "frazionabile" di oggi: è un limite delle fonti gratuite (API-NOTES, Fase 2).
|
- Gli universi passati usano i flag ETF e "frazionabile" di oggi: è un limite delle fonti gratuite (API-NOTES, Fase 2).
|
||||||
|
- Nella CI le prove tengono i database SQLite in una cartella in memoria, perché il disco dell'esecutore si ferma per secondi sotto carico (ADR 0019, pull request #110 unita il 3/12/2026).
|
||||||
- Gitea ha un esecutore delle Actions attivo: la CI gira a ogni push (prima esecuzione: run 169 del branch `fase-0`, test verdi su SQLite e PostgreSQL). `tasks ci` resta per provarla in locale.
|
- Gitea ha un esecutore delle Actions attivo: la CI gira a ogni push (prima esecuzione: run 169 del branch `fase-0`, test verdi su SQLite e PostgreSQL). `tasks ci` resta per provarla in locale.
|
||||||
- Su questo PC Docker Desktop non partiva: erano rimasti due file di comunicazione di una sessione di ottobre, che Windows non riusciva a cancellare. Le cartelle che li contengono sono state rinominate, non cancellate: `%LOCALAPPDATA%\Docker\run.stale*` e `%LOCALAPPDATA%\docker-secrets-engine.stale*`. Si possono eliminare dopo un riavvio.
|
- Su questo PC Docker Desktop non partiva: erano rimasti due file di comunicazione di una sessione di ottobre, che Windows non riusciva a cancellare. Le cartelle che li contengono sono state rinominate, non cancellate: `%LOCALAPPDATA%\Docker\run.stale*` e `%LOCALAPPDATA%\docker-secrets-engine.stale*`. Si possono eliminare dopo un riavvio.
|
||||||
|
|
||||||
@@ -206,7 +207,6 @@ Nulla.
|
|||||||
| Chiave di un modello linguistico (facoltativa) | Fase 7 | Solo classificatore locale |
|
| Chiave di un modello linguistico (facoltativa) | Fase 7 | Solo classificatore locale |
|
||||||
| Prova del template su Unraid, seguendo `docs/MANUALE.md` 2.6 | Ora | Criterio in attesa |
|
| Prova del template su Unraid, seguendo `docs/MANUALE.md` 2.6 | Ora | Criterio in attesa |
|
||||||
| Applicazione Open API e conto demo di cTrader (facoltativi) | Fase facoltativa | Si resta su eToro |
|
| Applicazione Open API e conto demo di cTrader (facoltativi) | Fase facoltativa | Si resta su eToro |
|
||||||
| Decidere sulla pull request #110 (test SQLite in memoria nella CI) | Quando vuoi | La CI resta come è |
|
|
||||||
| Permesso per ogni componente esterno non elencato nell'ADR 0004 | Quando serve | Si scrive in casa |
|
| Permesso per ogni componente esterno non elencato nell'ADR 0004 | Quando serve | Si scrive in casa |
|
||||||
|
|
||||||
Le chiavi non vanno mai scritte nel repository: si mettono nel file `.env` locale (modello in `.env.example`) oppure, più avanti, dall'interfaccia.
|
Le chiavi non vanno mai scritte nel repository: si mettono nel file `.env` locale (modello in `.env.example`) oppure, più avanti, dall'interfaccia.
|
||||||
@@ -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ì.
|
||||||
@@ -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"]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user