diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index cb247cf..da95322 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -168,6 +168,15 @@ jobs: else pip install -r requirements.txt pytest pytest-asyncio fi + # Relax durability on the throwaway CI Postgres so the per-test + # TRUNCATE's commit-fsync — the integration teardown's dominant cost + # (~1.5-2s/test per --durations, unchanged by pooling the teardown + # connection) — is skipped. fsync/full_page_writes are sighup GUCs and + # synchronous_commit is user-context, so ALTER SYSTEM + pg_reload_conf() + # applies them with NO restart. Ephemeral DB ⇒ fsync-off is safe. + # Non-fatal so a perms surprise can't red the shard; fabledcurator is + # the postgres image's bootstrap superuser. + python -c "import os,psycopg; c=psycopg.connect(host=os.environ['DB_HOST'],port=5432,user=os.environ['DB_USER'],password=os.environ['DB_PASSWORD'],dbname=os.environ['DB_NAME'],autocommit=True); [c.execute(q) for q in ('ALTER SYSTEM SET fsync=off','ALTER SYSTEM SET synchronous_commit=off','ALTER SYSTEM SET full_page_writes=off','SELECT pg_reload_conf()')]; c.close()" || echo 'WARN: durability GUC relax failed (continuing)' alembic upgrade head pytest tests/test_api_*.py -v -m integration --durations=15 @@ -226,6 +235,15 @@ jobs: else pip install -r requirements.txt pytest pytest-asyncio fi + # Relax durability on the throwaway CI Postgres so the per-test + # TRUNCATE's commit-fsync — the integration teardown's dominant cost + # (~1.5-2s/test per --durations, unchanged by pooling the teardown + # connection) — is skipped. fsync/full_page_writes are sighup GUCs and + # synchronous_commit is user-context, so ALTER SYSTEM + pg_reload_conf() + # applies them with NO restart. Ephemeral DB ⇒ fsync-off is safe. + # Non-fatal so a perms surprise can't red the shard; fabledcurator is + # the postgres image's bootstrap superuser. + python -c "import os,psycopg; c=psycopg.connect(host=os.environ['DB_HOST'],port=5432,user=os.environ['DB_USER'],password=os.environ['DB_PASSWORD'],dbname=os.environ['DB_NAME'],autocommit=True); [c.execute(q) for q in ('ALTER SYSTEM SET fsync=off','ALTER SYSTEM SET synchronous_commit=off','ALTER SYSTEM SET full_page_writes=off','SELECT pg_reload_conf()')]; c.close()" || echo 'WARN: durability GUC relax failed (continuing)' alembic upgrade head pytest tests/test_importer*.py tests/test_import_*.py tests/test_migration_*.py tests/test_phash_*.py tests/test_sidecar_*.py tests/test_scan_*.py tests/test_archive_extractor.py tests/test_backfill_phash.py -v -m integration --durations=15 @@ -284,6 +302,15 @@ jobs: else pip install -r requirements.txt pytest pytest-asyncio fi + # Relax durability on the throwaway CI Postgres so the per-test + # TRUNCATE's commit-fsync — the integration teardown's dominant cost + # (~1.5-2s/test per --durations, unchanged by pooling the teardown + # connection) — is skipped. fsync/full_page_writes are sighup GUCs and + # synchronous_commit is user-context, so ALTER SYSTEM + pg_reload_conf() + # applies them with NO restart. Ephemeral DB ⇒ fsync-off is safe. + # Non-fatal so a perms surprise can't red the shard; fabledcurator is + # the postgres image's bootstrap superuser. + python -c "import os,psycopg; c=psycopg.connect(host=os.environ['DB_HOST'],port=5432,user=os.environ['DB_USER'],password=os.environ['DB_PASSWORD'],dbname=os.environ['DB_NAME'],autocommit=True); [c.execute(q) for q in ('ALTER SYSTEM SET fsync=off','ALTER SYSTEM SET synchronous_commit=off','ALTER SYSTEM SET full_page_writes=off','SELECT pg_reload_conf()')]; c.close()" || echo 'WARN: durability GUC relax failed (continuing)' alembic upgrade head pytest tests/ -v -m integration --durations=15 \ --ignore-glob='tests/test_api_*.py' \