Conversation
各テストファイルの beforeAll では initTestDb(false) が dropSchema + synchronize で全テーブルを再作成するが、 globalSetup のテストサーバーはその間も起動し続けているため、 - サーバー側の非同期処理が drop 中のテーブルにアクセスして Unhandled Rejection (relation "user" does not exist) となり テストアノテーション無しでジョブ全体が落ちる - サーバーの接続ロックにより DROP がブロックされ hookTimeout (10s) 超過でファイル単位で落ちる という2形態のフレーキーな失敗が発生していた。 テストサーバーのコントローラーエンドポイントに /dispose と /launch を追加し、setup.e2e.ts を「サーバー停止 → DBリセット → サーバー起動」の順に変更することで、DB リセット時にアプリが 接続を持たない状態を作りレースを構造的に排除する。 併せて使用されなくなった /env-reset と sendEnvResetRequest を削除し、 killTestServer が自プロセスを kill しないようにガードを追加した。
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1314 +/- ##
===========================================
+ Coverage 23.14% 23.28% +0.14%
===========================================
Files 1259 1259
Lines 48348 48348
Branches 14258 14259 +1
===========================================
+ Hits 11188 11257 +69
+ Misses 29335 29274 -61
+ Partials 7825 7817 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Backend memory usage comparisonBefore GC
After GC
After Request
|
Contributor
|
このPRによるapi.jsonの差分 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
backend e2e テストにおいて、DB リセット(
initTestDb(false)の dropSchema + synchronize)の前に必ずテストサーバーを停止するよう順序を変更しました。test-server/entry.ts: コントローラーエンドポイントに/disposeと/launchを追加test/setup.e2e.ts:stopTestServer() → initTestDb(false) → startTestServer()の順に変更test/utils.ts:stopTestServer()/startTestServer()ヘルパーを追加し、利用されなくなったsendEnvResetRequest()を削除killTestServer()に自プロセスを kill しないガードを追加Why
2026.6.0 マージ以降、test-backend の E2E が不安定で develop の CI 失敗率が約 3 割に達していました。
各テストファイルの beforeAll では
dropSchema+synchronizeで全テーブルを再作成しますが、globalSetup のテストサーバーはその間も起動し続けているため、Unhandled Rejection (relation "user" does not exist)となり、テストアノテーション無しでジョブ全体が落ちるhookTimeout(10s) 超過でファイル単位で落ちるという 2 形態のフレーキーな失敗が発生していました(例: https://github.com/yojo-art/cherrypick/actions/runs/32644421590 )。
本 PR は DB リセット時にアプリが一切接続を持たない状態を作ることでレースを構造的に排除します。サーバーの再起動は従来も毎ファイル行われていたため、実行時間の増加はありません。
Additional info (optional)
Node v24.18.0 + PostgreSQL 18 + Redis 8 のローカル環境での検証結果:
* 失敗は
endpoints.tsのファイルアップロード 3 テストのみで、Node 24 の undici における FormData ブランドチェックの問題です。なお
move.tsがファイル内でinitTestDb(false)を呼ぶ箇所は既存パターンとして残っていますが、今回の実行では問題は観測されていません。Checklist