Mercurial > gemma
annotate schema/run_tests.sh @ 262:92470caf81fd
Add database function to check password against policy
Though it is currently only used in sys_admin-exclusive
functions, it is exposed to normal users because there is
nothing to hide and users should be able to change (and
check) their password, too.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 27 Jul 2018 15:26:16 +0200 |
parents | 946baea3d280 |
children | 13ad969a9138 |
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 |
a422471db08a
Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
2 |
a422471db08a
Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
3 dropdb --if-exists gemma_test |
246
299568ad3c37
Use database setup script for tests and Dockerfile
Tom Gottfried <tom@intevation.de>
parents:
234
diff
changeset
|
4 |
299568ad3c37
Use database setup script for tests and Dockerfile
Tom Gottfried <tom@intevation.de>
parents:
234
diff
changeset
|
5 ./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
|
6 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
|
7 |
224
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
8 # Collect test roles to be dropped |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
9 # 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
|
10 TEST_ROLES=$(psql -qtc \ |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
11 "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
|
12 WHERE rolname LIKE 'test%'") |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
13 |
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
14 # 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
|
15 psql -qXv ON_ERROR_STOP= -v -d gemma_test \ |
224
57dfab80973c
By convention, prefix all test users with 'test'
Tom Gottfried <tom@intevation.de>
parents:
223
diff
changeset
|
16 -c "DROP ROLE IF EXISTS $TEST_ROLES" \ |
196
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
17 -f tap_tests_data.sql \ |
262
92470caf81fd
Add database function to check password against policy
Tom Gottfried <tom@intevation.de>
parents:
247
diff
changeset
|
18 -c 'SELECT plan(40)' \ |
196
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
19 -f auth_tests.sql \ |
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
20 -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
|
21 -c 'SELECT * FROM finish()' |