Skip to content

Commit

Permalink
fix appveyor I think
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Nov 6, 2018
1 parent 853657b commit 109c24a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions test/setup_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@ PGPORT="${PGPORT:-5432}"
export PGPORT
PGHOST="${PGHOST:-localhost}"

# try to handle circleci/docker oddness
let rc=1
while [[ $rc -eq 1 ]]; do
nc -z ${PGHOST} ${PGPORT}
let rc=$?
done
if [[ $rc -ne 0 ]]; then
echo "Fatal: Could not connect to $PGHOST"
exit 1
fi
function connect_circle() {
# try to handle circleci/docker oddness
let rc=1
while [[ $rc -eq 1 ]]; do
nc -z ${PGHOST} ${PGPORT}
let rc=$?
done
if [[ $rc -ne 0 ]]; then
echo "Fatal: Could not connect to $PGHOST"
exit 1
fi
}

# appveyor doesn't have 'nc', but it also doesn't have these issues
if [[ -n $CIRCLECI ]]; then
connect_circle
fi

createdb dbt
psql -c "CREATE ROLE root WITH PASSWORD 'password';"
Expand Down

0 comments on commit 109c24a

Please sign in to comment.