Skip to content

Commit

Permalink
tests: buffer generated SQL using sponge βœ…πŸ’š
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Apr 10, 2023
1 parent 82570a4 commit daea895
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install sponge (moreutils)
run: sudo apt install -y moreutils

- name: install & start PostgreSQL with PostGIS
# todo: currently, it uses mdillon, which doesn't have PostgreSQL 14
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: install sponge (moreutils)
run: sudo apt install -y moreutils

- name: install & start PostgreSQL with PostGIS
# todo: currently, it uses mdillon, which doesn't have PostgreSQL 14
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install sponge (moreutils)
run: sudo apt install -y moreutils

- name: install & start PostgreSQL with PostGIS
# todo: currently, it uses mdillon, which doesn't have PostgreSQL 14
Expand Down
3 changes: 2 additions & 1 deletion test/amtrak-gtfs-2021-10-06.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export PGDATABASE='amtrak_2021_10_06'
--import-metadata \
--stats-by-route-date=view \
--stats-by-agency-route-stop-hour=view \
-- amtrak-gtfs-2021-10-06/*.txt | psql -b
-- amtrak-gtfs-2021-10-06/*.txt \
| sponge | psql -b

query=$(cat << EOF
select extract(epoch from t_arrival)::integer as t_arrival
Expand Down
4 changes: 3 additions & 1 deletion test/calendar-dates-only.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ env | grep '^PG' || true
psql -c 'create database calendar_dates_only'
export PGDATABASE='calendar_dates_only'

../cli.js -d --trips-without-shape-id -- calendar-dates-only/*.txt | psql -b
../cli.js -d --trips-without-shape-id -- \
calendar-dates-only/*.txt \
| sponge | psql -b

query=$(cat << EOF
select extract(epoch from t_arrival)::integer as t_arrival
Expand Down
2 changes: 1 addition & 1 deletion test/postgraphile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export PGDATABASE='postgraphile'

../cli.js -d --trips-without-shape-id --postgraphile -- \
../node_modules/sample-gtfs-feed/gtfs/*.txt \
| psql -b
| sponge | psql -b

# kill child processes on exit
# https://stackoverflow.com/questions/360201/how-do-i-kill-background-processes-jobs-when-my-shell-script-exits/2173421#2173421
Expand Down
2 changes: 1 addition & 1 deletion test/sample-gtfs-feed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export PGDATABASE='sample_gtfs_feed'
../node_modules/sample-gtfs-feed/gtfs/levels.txt \
../node_modules/sample-gtfs-feed/gtfs/pathways.txt \
../node_modules/sample-gtfs-feed/gtfs/translations.txt \
| psql -b
| sponge | psql -b

query=$(cat << EOF
select extract(epoch from t_arrival)::integer as t_arrival
Expand Down

0 comments on commit daea895

Please sign in to comment.