Repository navigation
test: reuse testcontainers harness for condenser reconcile tests - #371
Merged
aivong-openhands merged 1 commit intoSep 11, 2026
Conversation
Port the org condenser reconcile tests off the bespoke Postgres harness (a GitHub service container + POSTGRES_TEST_DATABASE_URL, with the schema hand-built via Org table metadata) and onto the existing testcontainers harness fixtures in tests/unit/conftest.py. The async_session_maker fixture already provides a per-test database cloned from the alembic-migrated template, so the tests now exercise the real schema (including migration 108 server_default on org.agent_settings) instead of a model-derived one. They run under the existing py-tests workflow with no new CI, service container, or POSTGRES_TEST_DATABASE_URL wiring. Verified locally against testcontainers postgres:16: all 3 tests pass. Follow-ups that need the workflow OAuth scope (this automation cannot push workflow files): delete .github/workflows/postgres-integration-tests.yml, and close PR #369 which only worked around the old harness collision. Co-authored-by: openhands <openhands@all-hands.dev>
aivong-openhands
merged commit Sep 11, 2026
686d477
into
openhands-org-condenser-defaults-enterprise-20260909
9 of 10 checks passed
aivong-openhands
added a commit
that referenced
this pull request
Sep 11, 2026
) * Add org condenser default rollout configuration Co-authored-by: openhands <openhands@all-hands.dev> * Add org condenser rollout regression tests Co-authored-by: openhands <openhands@all-hands.dev> * test: reuse testcontainers harness for condenser reconcile tests (#371) Port the org condenser reconcile tests off the bespoke Postgres harness (a GitHub service container + POSTGRES_TEST_DATABASE_URL, with the schema hand-built via Org table metadata) and onto the existing testcontainers harness fixtures in tests/unit/conftest.py. The async_session_maker fixture already provides a per-test database cloned from the alembic-migrated template, so the tests now exercise the real schema (including migration 108 server_default on org.agent_settings) instead of a model-derived one. They run under the existing py-tests workflow with no new CI, service container, or POSTGRES_TEST_DATABASE_URL wiring. Verified locally against testcontainers postgres:16: all 3 tests pass. Follow-ups that need the workflow OAuth scope (this automation cannot push workflow files): delete .github/workflows/postgres-integration-tests.yml, and close PR #369 which only worked around the old harness collision. Co-authored-by: openhands <openhands@all-hands.dev> * Delete .github/workflows/postgres-integration-tests.yml --------- Co-authored-by: openhands <openhands@all-hands.dev>
1 of 6 tasks
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.
Ports the org condenser reconcile tests onto the existing testcontainers harness, per the discussion on #369.
Base is the
openhands-org-condenser-defaults-enterprise-20260909branch (#337), because the tests exerciseOrgStore.reconcile_applicable_org_condenser_max_tokens, which only exists there. Merge this into #337.What changed
tests/integration/test_org_condenser_reconciliation_postgres.py→tests/unit/test_org_condenser_reconciliation.py.postgres_session_makerfixture (service container +POSTGRES_TEST_DATABASE_URL+Org.__table__.drop/create) in favour of the harness'sasync_session_makerfixture fromtests/unit/conftest.py.postgresqlmarker frompytest.ini.The three test bodies and all assertions are unchanged — only the database plumbing was swapped.
Why
As discussed in #369: the harness
async_session_makeralready gives each test an isolated database cloned from thealembic upgrade headtemplate. That means:server_defaultonorg.agent_settings), not a schema hand-built from the model.py-testsworkflow (which already installs--all-groupsand starts the harness). No new workflow, no service container, noPOSTGRES_TEST_DATABASE_URL.ModuleNotFoundError: No module named 'testcontainers'; it disappears entirely.Verification
Ran locally against a real testcontainers
postgres:16(uv sync --locked --all-groups+uv run pytest tests/unit/test_org_condenser_reconciliation.py):Two follow-ups I could not do (token lacks the
workflowOAuth scope).github/workflows/postgres-integration-tests.yml— it is now orphaned (it runspytest -m postgresql tests/integration, and that directory/marker are gone). Until it is removed, its check on feat: PLTF-3553 Add org condenser max_tokens rollout configuration #337 will fail; thepy-testscheck is the one that now covers these tests.This PR was created by an AI agent (OpenHands) on behalf of the user.
Enterprise server image for this PR: