-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
source-redshift-batch: Test against Postgres in CI
Redshift is kind of PostgreSQL and kind of not (for instance, Redshift has a completely different columnar storage engine and doesn't expose an XMIN system column), but it's close enough that our test suite passes when run against Postgres. Since it's tricky to test against Redshift in CI builds, we might as well do the next-best thing and test against a local Postgres instance since practically speaking the alternative is no CI tests at all.
- Loading branch information
1 parent
6490f6f
commit 6c26ace
Showing
5 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 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,30 @@ | ||
services: | ||
db: | ||
image: 'postgres:latest' | ||
command: [ "postgres" ] | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
{ | ||
"POSTGRES_DB": "postgres", | ||
"POSTGRES_USER": "postgres", | ||
"POSTGRES_PASSWORD": "postgres" | ||
} | ||
healthcheck: | ||
test: "true" | ||
interval: 3s | ||
networks: | ||
- flow-test | ||
volumes: | ||
- type: bind | ||
source: ./docker-initdb.sh | ||
target: /docker-entrypoint-initdb.d/init-user-db.sh | ||
- postgres_data:/var/lib/postgresql/data | ||
|
||
networks: | ||
flow-test: | ||
name: flow-test | ||
external: true | ||
|
||
volumes: | ||
postgres_data: {} |
This file contains 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,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL | ||
CREATE USER flow_capture WITH PASSWORD 'secret1234' REPLICATION; | ||
CREATE SCHEMA IF NOT EXISTS test; | ||
GRANT USAGE ON SCHEMA test TO flow_capture; | ||
ALTER DEFAULT PRIVILEGES IN SCHEMA test GRANT SELECT ON TABLES to flow_capture; | ||
GRANT SELECT ON ALL TABLES IN SCHEMA test TO flow_capture; | ||
GRANT CREATE, USAGE ON SCHEMA public TO flow_capture; | ||
CREATE EXTENSION IF NOT EXISTS citext; | ||
EOSQL |
This file contains 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