feat: Add seed.pgpm() adapter and pgpm integration tests - #3
Merged
Merged
Conversation
- Add PgpmSeedAdapter that calls pgpm CLI via subprocess - Pass database connection info via PGHOST/PGPORT/PGDATABASE/PGUSER/PGPASSWORD env vars - Add pre-scaffolded pgpm workspace fixture with test-module - Add test_pgpm_integration.py with tests for pgpm deploy and @pgpm/faker - Add test-pgpm.yml workflow that: - Installs pgpm CLI globally - Installs @pgpm/faker in the test fixture - Runs pgpm admin-users bootstrap - Runs pgpm integration tests This demonstrates Option 1: using pgpm as a CLI tool from Python to run database migrations without rewriting pgpm in Python.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
- Exclude tests/test_pgpm_integration.py from regular test workflow (pgpm CLI not installed in that workflow) - Add --verbose flag to pgpm deploy for better debugging - Log stdout and stderr from pgpm deploy for troubleshooting
Add -s and --log-cli-level=INFO to pytest to capture pgpm deploy output
The pgpm deploy command was showing an interactive prompt to choose a package instead of actually deploying. This fix adds a 'package' parameter to the seed.pgpm() adapter that passes --package to pgpm deploy, avoiding the interactive prompt in CI/non-interactive environments.
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.
Summary
Adds a
seed.pgpm()adapter that allows Python tests to use pgpm (PostgreSQL Package Manager) for database migrations without rewriting pgpm in Python. This implements "Option 1" from the integration discussion - treating pgpm as a CLI tool called via subprocess.Key changes:
PgpmSeedAdapterclass that callspgpm deployvia subprocess, passing database connection info through environment variablestests/fixtures/pgpm-workspace/) with a test module@pgpm/fakertest-pgpm.yml) for pgpm integration testsUpdates since last revision
packageparameter toseed.pgpm()to specify which package to deploy, avoiding interactive prompts in CI/non-interactive environments-s --log-cli-level=INFO) for better debuggingReview & Testing Checklist for Human
packageparameter usage - Thepackageparameter is required to avoid pgpm's interactive "Choose a package to deploy" prompt. Without it, pgpm may hang in non-interactive environments.cacheparameter is not implemented - The adapter accepts acacheparameter but it's not yet functional (documented in docstring).Test plan:
test_pgpm_integration.pyactually execute (not skipped)cd tests/fixtures/pgpm-workspace/packages/test-module && pgpm install @pgpm/faker, then runpoetry run pytest tests/test_pgpm_integration.py -vNotes
npm install -g pgpm)ghcr.io/constructive-io/docker/postgres-plus:17image consistent with other workflows2.7.9in the workflowLink to Devin run: https://app.devin.ai/sessions/1203eea9373240d797329ae288ab6dd7
Requested by: Dan Lynch (@pyramation)