Skip to content

Commit

Permalink
Exit setup/test scripts on error with set -e
Browse files Browse the repository at this point in the history
https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script

Should make it easier to spot a failing test in all the output
  • Loading branch information
timabell committed Jan 18, 2024
1 parent a5dbce2 commit 2505ea4
Show file tree
Hide file tree
Showing 24 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions mssql/docker-first-run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh -v
set -e

# https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-2017

Expand Down
1 change: 1 addition & 0 deletions mssql/test-mssql-multi-db.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

echo "=================="
echo "mssql multidb"
Expand Down
1 change: 1 addition & 0 deletions mssql/test-mssql.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

echo "=================="
echo "mssql"
Expand Down
1 change: 1 addition & 0 deletions mysql/docker-first-run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh -v
set -e
docker pull mysql:latest
docker run --name sse-mysql -e MYSQL_ROOT_PASSWORD=omgroot -p 3306:3306 -d mysql:latest
sleep 25 # wait for container to come up
Expand Down
1 change: 1 addition & 0 deletions mysql/run-mysql.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
cd ..

export schemaexplorer_driver=mysql
Expand Down
1 change: 1 addition & 0 deletions mysql/setup-once.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/sh
set -e
docker exec -i sse-mysql mysql -pomgroot < setup-user.sql
1 change: 1 addition & 0 deletions mysql/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
docker exec sse-mysql mysql -pomgroot -e "drop database if exists ssetest;"
docker exec sse-mysql mysql -pomgroot -e "create database ssetest;"
docker exec -i sse-mysql mysql -pomgroot ssetest < test-db.sql
Expand Down
1 change: 1 addition & 0 deletions mysql/test-mysql.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

echo "=================="
echo "mysql"
Expand Down
1 change: 1 addition & 0 deletions pg/docker-start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh -v
set -e
# https://hackernoon.com/dont-install-postgres-docker-pull-postgres-bee20e200198
mkdir -p $HOME/docker/volumes/postgres
docker run --rm --name pg-docker -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres:9.6
1 change: 1 addition & 0 deletions pg/run-pg-multi-db.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
cd ..

export schemaexplorer_driver=pg
Expand Down
1 change: 1 addition & 0 deletions pg/run-pg.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
cd ..

export schemaexplorer_driver=pg
Expand Down
1 change: 1 addition & 0 deletions pg/setup-me.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh -v
set -e
sudo -u postgres createuser $USER
sudo -u postgres createdb $USER
sudo -u postgres psql -c "alter user $USER with superuser;" # https://stackoverflow.com/a/10757486/10245
1 change: 1 addition & 0 deletions pg/setup-ssetest.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
usr=ssetestusr
db=ssetest
# config for pg in docker as per dev-setup.sh
Expand Down
1 change: 1 addition & 0 deletions pg/test-pg-multi-db.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

echo "=================="
echo "postgres multi-db"
Expand Down
1 change: 1 addition & 0 deletions pg/test-pg.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

echo "=================="
echo "postgres"
Expand Down
1 change: 1 addition & 0 deletions sqlite/run-sqlite-env.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
# relative path hack with pwd, otherwise not resolved.
# create db first with sqlite/setup.sh
cd ..
Expand Down
1 change: 1 addition & 0 deletions sqlite/run-sqlite-flags.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
# relative path hack with pwd, otherwise not resolved.
# create db first with sqlite/setup.sh
cd ..
Expand Down
1 change: 1 addition & 0 deletions sqlite/run-sqlite-test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
# relative path hack with pwd, otherwise not resolved.
# create db first with sqlite/setup.sh
cd ..
Expand Down
1 change: 1 addition & 0 deletions sqlite/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
if [ -d db ]; then
# echo 'removing old test db'
rm -rf db
Expand Down
1 change: 1 addition & 0 deletions sqlite/test-sqlite-env.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

echo "=================="
echo "sqlite"
Expand Down
1 change: 1 addition & 0 deletions sqlite/test-sqlite-flags.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

echo "=================="
echo "sqlite flags"
Expand Down
1 change: 1 addition & 0 deletions sqlite/test-sqlite-live.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

echo "=================="
echo "sqlite (live)"
Expand Down
1 change: 1 addition & 0 deletions test-only-build-pg.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/sh
set -e
go test -tags "skip_mysql skip_sqlite skip_mssql" sse_test.go
2 changes: 2 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
set -e

pushd . > /dev/null
cd sqlite
# test the three ways of configuring schemaexplorer
Expand Down

0 comments on commit 2505ea4

Please sign in to comment.