-
Notifications
You must be signed in to change notification settings - Fork 10
More thorough integration tests for pg, redshift, snowflake, bq #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1524165
more thorough integration tests for pg, redshift, snowflake, bq
kmacrow 5e27ad9
tidy and comments
kmacrow bfac2f2
add gh workflow to run pg integration tests on PRs
kmacrow e9f4490
fix csv name in workflow
kmacrow c27a1b1
remove psutil dependency
kmacrow b80fdd3
add dotenv dependency
kmacrow 1175eae
update README and include path in comments
kmacrow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| name: Data Transfer Integration Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| postgresql-connector: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres:16 | ||
| env: | ||
| POSTGRES_USER: test | ||
| POSTGRES_PASSWORD: test | ||
| POSTGRES_DB: pontoon | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd="pg_isready -U test" | ||
| --health-interval=10s | ||
| --health-timeout=5s | ||
| --health-retries=5 | ||
|
|
||
| env: | ||
| ENV: test | ||
| POSTGRES_USER: test | ||
| POSTGRES_PASSWORD: test | ||
| POSTGRES_DATABASE: pontoon | ||
| POSTGRES_HOST: localhost | ||
| POSTGRES_PORT: 5432 | ||
| ALLOW_ORIGIN: http://localhost:3000 | ||
| JWT_ALGORITHM: HS256 | ||
| JWT_SIGNING_KEY: test_key | ||
| SKIP_TRANSFERS: true | ||
|
|
||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.12 | ||
|
|
||
| - name: Wait for DB to be ready | ||
| run: | | ||
| for i in {1..10}; do | ||
| pg_isready -h localhost -U test && break | ||
| echo "Waiting for postgres..." && sleep 2 | ||
| done | ||
|
|
||
| - name: Run integration tests | ||
| working-directory: data-transfer/pontoon | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pytest python-dotenv | ||
| pip install . | ||
|
|
||
| cat <<EOF > .env | ||
| POSTGRES_HOST=localhost | ||
| POSTGRES_USER=test | ||
| POSTGRES_PASSWORD=test | ||
| POSTGRES_DATABASE=pontoon | ||
| EOF | ||
|
|
||
| PGPASSWORD=test psql -h localhost -U test -d pontoon -c "CREATE SCHEMA source;" | ||
| PGPASSWORD=test psql -h localhost -U test -d pontoon -c "CREATE SCHEMA target;" | ||
| PGPASSWORD=test psql -h localhost -U test -d pontoon -c "CREATE TABLE source.leads_xs (id uuid NOT NULL,created_at timestamp NOT NULL,updated_at timestamp NOT NULL,customer_id text NOT NULL,name text NOT NULL,email text NOT NULL,score integer NOT NULL,notes text);" | ||
| PGPASSWORD=test psql -h localhost -U test -d pontoon -c "\COPY source.leads_xs(id,created_at,updated_at,customer_id,name,email,score,notes) FROM 'tests/data/leads_xs_20250701.csv' CSV HEADER;" | ||
|
|
||
| pytest -s tests/integration/test_postgres_connectors.py |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ build-wheel: | |
| test: | ||
| pytest -s | ||
|
|
||
| test-integration: | ||
| pytest -s tests/integration/ | ||
|
|
||
| install-dev: | ||
| pip install -e . | ||
|
|
||
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have this at a higher level instead of having it in each destination connector?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd definitely be possible in the orchestration layer (somewhere around here) to remove zero-length streams from the
Datasetbefore passing it todestination.write(), but I kind of think the connectors should be able to gracefully handle an empty stream since nothing in the interface contract prevents passing one in. Another thing we could do (but might actually be less clear) would be making theDataset.streamsiterator skip empty streams, but that limits a connector's ability to do something (bookkeeping / logging?) with empty streams.