Mercurial > gemma
annotate schema/run_tests.sh @ 3972:72473ebd9d64
Bufferd kill signal channel to not miss signals if recieving code is not ready.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 17 Jul 2019 11:26:36 +0200 |
parents | 29ef6d41e4af |
children | 3cec90587ff9 |
rev | line source |
---|---|
172
a422471db08a
Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
1 #!/bin/sh -e |
1303
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
2 # This is Free Software under GNU Affero General Public License v >= 3.0 |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
3 # without warranty, see README.md and license for details. |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
4 # |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
5 # SPDX-License-Identifier: AGPL-3.0-or-later |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
6 # License-Filename: LICENSES/AGPL-3.0.txt |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
7 # |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
8 # Copyright (C) 2018 by via donau |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
9 # – Österreichische Wasserstraßen-Gesellschaft mbH |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
10 # Software engineering by Intevation GmbH |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
11 # |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
12 # Author(s): |
a8d1f2897c42
repair schema install scripts
Bernhard Reiter <bernhard@intevation.de>
parents:
1301
diff
changeset
|
13 # * Tom Gottfried <tom@intevation.de> |
172
a422471db08a
Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
14 |
a422471db08a
Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
15 dropdb --if-exists gemma_test |
246
299568ad3c37
Use database setup script for tests and Dockerfile
Tom Gottfried <tom@intevation.de>
parents:
234
diff
changeset
|
16 |
299568ad3c37
Use database setup script for tests and Dockerfile
Tom Gottfried <tom@intevation.de>
parents:
234
diff
changeset
|
17 ./install-db.sh -d gemma_test |
183
f3a09fc9c1eb
Prepare for having more than one database test script
Tom Gottfried <tom@intevation.de>
parents:
172
diff
changeset
|
18 psql -qv ON_ERROR_STOP= -c 'CREATE EXTENSION pgtap' -d gemma_test |
172
a422471db08a
Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
19 |
224
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
20 # Collect test roles to be dropped |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
21 # Concatenate with dummy role to prevent syntax error if there is no test role |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
22 TEST_ROLES=$(psql -qtc \ |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
23 "SELECT concat_ws(',', 'test', string_agg(rolname, ',')) FROM pg_roles |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
24 WHERE rolname LIKE 'test%'") |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
25 |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
26 # Drop test roles, add test data and run tests |
222
cfde876fbaf9
Try to DROP ROLEs before creating them and keep test results
Tom Gottfried <tom@intevation.de>
parents:
207
diff
changeset
|
27 psql -qXv ON_ERROR_STOP= -v -d gemma_test \ |
324
8bacd556ea39
Remove noisy NOTICEs between test output
Tom Gottfried <tom@intevation.de>
parents:
319
diff
changeset
|
28 -c 'SET client_min_messages TO WARNING' \ |
224
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
29 -c "DROP ROLE IF EXISTS $TEST_ROLES" \ |
196
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
30 -f tap_tests_data.sql \ |
3665
29ef6d41e4af
Use database triggers to move referencing objects to new versions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
31 -c "SELECT plan(71 + ( |
3024
5470aa3ffb9a
Fix privileges for GeoServer views
Tom Gottfried <tom@intevation.de>
parents:
2912
diff
changeset
|
32 SELECT count(*)::int |
5470aa3ffb9a
Fix privileges for GeoServer views
Tom Gottfried <tom@intevation.de>
parents:
2912
diff
changeset
|
33 FROM information_schema.tables |
5470aa3ffb9a
Fix privileges for GeoServer views
Tom Gottfried <tom@intevation.de>
parents:
2912
diff
changeset
|
34 WHERE table_schema = 'waterway'))" \ |
2781
a2127495093e
Prevent duplicate waterway axis and area geometries
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
35 -f gemma_tests.sql \ |
569
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
478
diff
changeset
|
36 -f isrs_tests.sql \ |
196
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
37 -f auth_tests.sql \ |
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
38 -f manage_users_tests.sql \ |
222
cfde876fbaf9
Try to DROP ROLEs before creating them and keep test results
Tom Gottfried <tom@intevation.de>
parents:
207
diff
changeset
|
39 -c 'SELECT * FROM finish()' |