(chore) The API unit job has no Postgres, so every database-backed test skips in CI

オープン
#7,040 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
github-actions, postgresql, python

調査の方向性

Start with run-api-unit-tests in .github/workflows/12-check-unit-tests.yml and the skip fixture in api/oss/tests/pytest/unit/sessions/conftest.py; review how the job configures services and database URIs. The issue proposes adding Postgres and setting both URIs, or making CI report or fail on skips. Run the API unit job and verify the database-backed tests execute rather than silently skip.

索引モデルが issue の本文から書いたものです。

説明

chore ci/cd tests

The API unit job in CI has no database, so every database-backed test in the API unit suite skips there. The job reports success with 179 tests skipped, and the check reads the same as it would if they had all passed.

What happens

run-api-unit-tests in .github/workflows/12-check-unit-tests.yml:260-309 has no services: block and sets no POSTGRES_URI_CORE. The suite's own fixture handles that gracefully: api/oss/tests/pytest/unit/sessions/conftest.py probes the database URI once and skips every test marked integration when nothing answers.

@pytest.fixture(autouse=True)
def _skip_when_postgres_unreachable(request):
    if request.node.get_closest_marker("integration") and not _postgres_reachable():
        pytest.skip("Postgres not reachable — skipping session DAO integration tests")

The skip is the right behaviour on a developer's machine, where load-env leaves the URI commented out. In CI it means the tests never run anywhere, and nothing says so on the pull request.

The effect is concrete. Three new tests for the session dispatch claim, written to prove that the claim and its release behave correctly under real SQL, are part of that skip set: the published CI result for the head that added them reads 5210 passed and 179 skipped, with the skip count up by exactly three against the previous head. The compare-and-set guards can be deleted from the real SQL and CI stays green. Verified by standing up a throwaway Postgres and running both migration chains into it, at which point the same file goes from 41 skipped to 41 passed.

Proposed fix

Add a postgres:17 service to run-api-unit-tests and set POSTGRES_URI_CORE (and POSTGRES_URI_TRACING, which a second set of cases probes the same way) so the database-backed tests actually run. The suite already applies the migration chains it needs, and the fixture keeps skipping on a bare developer machine, which is where the skip was intended.

If a database in that job is not wanted, the alternative is to stop letting the skip pass silently: fail the job when a marked test skips in CI, or publish the skip count as part of the check, so a reader can tell a green check from an empty one.

主要言語
TypeScript
スター
4.8k
フォーク
690
平均マージ
20時間 11分
マージ済み PR(30日)
448

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Agenta-AI/agenta のほかの issue

Agenta-AI/agenta の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。