Adding -x to nosetests and correcting DB setup scripts

This commit is contained in:
Zachary Klosko 2020-12-09 18:07:48 -05:00
parent 97db37e9f2
commit b444f7d3b1
2 changed files with 7 additions and 21 deletions

View File

@ -31,22 +31,8 @@ apt-get install -y gstreamer1.0-plugins-base \
postgresql-client postgresql-client
# Creating database for testing # Creating database for testing
setupAirtimePostgresUser() { -u postgres psql -c 'CREATE DATABASE libretime;'
# here-doc to execute this block as postgres user -u postgres psql -c "CREATE USER libretime WITH PASSWORD 'libretime';"
su postgres <<'EOF' -u postgres psql -c 'GRANT CONNECT ON DATABASE libretime TO libretime;'
set +e -u postgres psql -c 'ALTER USER libretime CREATEDB;'
count=$(psql -d postgres -tAc "SELECT count(*) FROM pg_roles WHERE rolname='airtime';") mkdir -p /tmp/log/libretime
if [[ $count -eq 0 ]]; then
psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB; CREATE DATABASE libretime; GRANT CONNECT ON DATABASE libretime TO libretime;"
[[ $? -eq 0 ]] &&
echo "Created airtime user in PostgreSQL" ||
echo "$0:${FUNCNAME}(): ERROR: Can't create airtime user in PostgreSQL!"
else
echo "airtime user already exists in PostgreSQL"
fi
set -e
# don't indent this!
EOF
}
setupAirtimePostgresUser

View File

@ -3,10 +3,10 @@
# Starting at repo root # Starting at repo root
cd python_apps/airtime_analyzer cd python_apps/airtime_analyzer
nosetests . nosetests . -x
cd ../api_clients cd ../api_clients
nosetests . nosetests . -x
# Reset to repo root # Reset to repo root
cd ../.. cd ../..