view schema/run_tests.sh @ 196:b67208d82543

Make test output more comprehensive Running all tests in one transaction ensures the final output tells about any failing test, not just in the last transaction (i.e. test script). The price is that no traces of the tests are left in the database because we have to rollback in order to have no left-over test roles in the cluster.
author Tom Gottfried <tom@intevation.de>
date Fri, 20 Jul 2018 18:31:45 +0200
parents a9d9c2b1d08c
children 88d21c29cf04
line wrap: on
line source

#!/bin/sh -e

dropdb --if-exists gemma_test
createdb gemma_test
psql -qv ON_ERROR_STOP= -c 'CREATE EXTENSION pgtap' -d gemma_test

psql -qv ON_ERROR_STOP= -d gemma_test \
    -f gemma.sql \
    -f auth.sql \
    -f manage_users.sql

# Add test data, run tests and ROLLBACK to prevent test roles to stay
# in cluster, which would prevent tests from being repeatable
psql -qXv ON_ERROR_STOP= -v AUTOCOMMIT=off -d gemma_test \
    -f tap_tests_data.sql \
    -c 'SELECT plan(22)' \
    -f auth_tests.sql \
    -f manage_users_tests.sql \
    -c 'SELECT * FROM finish()' \
    -c 'ROLLBACK'