Skip to content

fix(ci): stabilize regtest Postgres tests and regtest workflows#966

Open
b-l-u-e wants to merge 1 commit intocashubtc:mainfrom
b-l-u-e:ci/regtest-mint-timeout
Open

fix(ci): stabilize regtest Postgres tests and regtest workflows#966
b-l-u-e wants to merge 1 commit intocashubtc:mainfrom
b-l-u-e:ci/regtest-mint-timeout

Conversation

@b-l-u-e
Copy link
Copy Markdown
Contributor

@b-l-u-e b-l-u-e commented Mar 31, 2026

10‑minute job timeout – Jobs were cancelled mid‑pytest (operation canceled), so often never saw a real pass/fail. so i raise timeout-minutes so the suite can finish.
After the timeout was raised – Many runs completed and showed ~3–4 minutes for tests/wallet / tests/mint in some matrix cells saw tests. So duration was under the old 10‑minute cap in those cases; the cap was still wrong for slower/heavier rows or when setup + tests add up.
then noticed one matrix run hit DeadlockDetectedError on DROP SCHEMA public CASCADE in the ledger fixture

Improves reliability of mint tests against PostgreSQL in CI, deduplicates regtest setup via a shared composite action, and hardens Postgres orchestration (service containers, digest-pinned image, consistent cleanup). Raises job timeouts so slow Lightning/regtest runs are not killed mid-suite, and fixes test assertions and DB cleanup so Postgres matrix jobs pass consistently.

Tests (tests/conftest.py)

  • Replace per-test DROP SCHEMA public CASCADE with a TRUNCATE-based cleanup that keeps the schema and avoids heavy locking/deadlock issues.
  • Build table names with quote_ident (no % in SQL strings) so Postgres queries stay valid after Connection.rewrite_query doubles % for SQLAlchemy.
  • Do not truncate dbversions, so migration version rows stay aligned with the existing schema; avoids ADD COLUMN … already exists when migrations would otherwise re-run after truncate.
  • Remove stray print("teardown") from the ledger fixture.

Tests (tests/mint/test_mint_melt.py)

  • Extend assert_err with optional contains=True for substring checks; default remains exact match.
  • Fix test_mint_pay_with_duplicate_checking_id: await assert_err(...) and use contains=True so wrapped wallet errors (e.g. mint error prefix) still match.

CI

  • Composite action .github/actions/regtest-run: clone/start regtest; for Postgres, create a unique DB per run/backend (MINT_TEST_DATABASE), run make test-mint / test-wallet, pg_terminate_backend + DROP DATABASE cleanup with retries, dump Postgres logs on failure.
  • Postgres in CI: regtest-mint.yml and regtest-wallet.yml use GitHub service containers (health-checked) instead of ad-hoc docker run, with use-github-postgres-service so the app talks to localhost:5432 and admin ops use psql + shared PGADMINURL. The docker run path remains for other callers that keep the default.
  • Reproducibility: workflow-level REGTEST_POSTGRES_IMAGE is digest-pinned; pass postgres-image into the composite so services.postgres.image, fallback docker run, and log capture all reference the same image ref.
  • regtest-mint.yml / regtest-wallet.yml: timeout-minutes: 120, upload artifacts on failure, Codecov with if: always() where applicable.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.05%. Comparing base (a1ff72c) to head (aae9635).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #966      +/-   ##
==========================================
+ Coverage   74.90%   75.05%   +0.14%     
==========================================
  Files          99       99              
  Lines       11685    11714      +29     
==========================================
+ Hits         8753     8792      +39     
+ Misses       2932     2922      -10     
Flag Coverage Δ
mint-CLNRestWallet 55.53% <ø> (?)
mint-CoreLightningRestWallet 55.18% <ø> (?)
mint-LNbitsWallet 55.39% <ø> (?)
mint-LndRPCWallet 55.06% <ø> (?)
mint-LndRestWallet 55.45% <ø> (?)
wallet-CLNRestWallet 49.11% <ø> (?)
wallet-CoreLightningRestWallet 48.78% <ø> (?)
wallet-LNbitsWallet 48.63% <ø> (?)
wallet-LndRPCWallet 49.14% <ø> (?)
wallet-LndRestWallet 49.25% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@b-l-u-e b-l-u-e force-pushed the ci/regtest-mint-timeout branch from 6a2778b to 55fa2b2 Compare March 31, 2026 12:38
@b-l-u-e b-l-u-e closed this Mar 31, 2026
@github-project-automation github-project-automation bot moved this from Backlog to Done in nutshell Mar 31, 2026
@b-l-u-e b-l-u-e reopened this Mar 31, 2026
@b-l-u-e b-l-u-e force-pushed the ci/regtest-mint-timeout branch 4 times, most recently from e4474c3 to d466744 Compare March 31, 2026 19:35
@b-l-u-e b-l-u-e closed this Mar 31, 2026
@b-l-u-e b-l-u-e reopened this Mar 31, 2026
@b-l-u-e b-l-u-e force-pushed the ci/regtest-mint-timeout branch from d466744 to 2d9510c Compare March 31, 2026 20:34
@b-l-u-e b-l-u-e closed this Mar 31, 2026
@b-l-u-e b-l-u-e reopened this Mar 31, 2026
@b-l-u-e b-l-u-e force-pushed the ci/regtest-mint-timeout branch 6 times, most recently from f41e66c to 0a0f189 Compare April 1, 2026 16:58
@b-l-u-e b-l-u-e closed this Apr 1, 2026
@b-l-u-e b-l-u-e reopened this Apr 1, 2026
@b-l-u-e b-l-u-e marked this pull request as ready for review April 1, 2026 17:03
@b-l-u-e b-l-u-e changed the title fix(ci): avoid cancelling regtest-mint mid-suite fix(ci): stabilize regtest Postgres tests and regtest workflows Apr 1, 2026
@b-l-u-e b-l-u-e marked this pull request as draft April 1, 2026 17:37
@callebtc callebtc marked this pull request as ready for review April 1, 2026 18:13
@b-l-u-e b-l-u-e force-pushed the ci/regtest-mint-timeout branch from 0a0f189 to aae9635 Compare April 2, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant