Mercurial > gemma
annotate schema/run_tests.sh @ 207:88d21c29cf04
Care for the fact that role attributes are not inherited
Tests are now run with login roles instead of abstract base roles.
create_user has become a SECURITY DEFINER function, thus circumventing
RLS policies and that a sys_admin cannot CREATE ROLEs by himself. A test
has been added to showcase the intentional error in case the name of
an abstract base role is used as a new username.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 23 Jul 2018 11:29:41 +0200 |
parents | b67208d82543 |
children | cfde876fbaf9 |
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 |
a422471db08a
Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
4 createdb gemma_test |
183
f3a09fc9c1eb
Prepare for having more than one database test script
Tom Gottfried <tom@intevation.de>
parents:
172
diff
changeset
|
5 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
|
6 |
185
a9d9c2b1d08c
Add database function to create role and user profile
Tom Gottfried <tom@intevation.de>
parents:
183
diff
changeset
|
7 psql -qv ON_ERROR_STOP= -d gemma_test \ |
a9d9c2b1d08c
Add database function to create role and user profile
Tom Gottfried <tom@intevation.de>
parents:
183
diff
changeset
|
8 -f gemma.sql \ |
a9d9c2b1d08c
Add database function to create role and user profile
Tom Gottfried <tom@intevation.de>
parents:
183
diff
changeset
|
9 -f auth.sql \ |
a9d9c2b1d08c
Add database function to create role and user profile
Tom Gottfried <tom@intevation.de>
parents:
183
diff
changeset
|
10 -f manage_users.sql |
172
a422471db08a
Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
11 |
196
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
12 # Add test data, run tests and ROLLBACK to prevent test roles to stay |
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
13 # in cluster, which would prevent tests from being repeatable |
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
14 psql -qXv ON_ERROR_STOP= -v AUTOCOMMIT=off -d gemma_test \ |
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
15 -f tap_tests_data.sql \ |
207
88d21c29cf04
Care for the fact that role attributes are not inherited
Tom Gottfried <tom@intevation.de>
parents:
196
diff
changeset
|
16 -c 'SELECT plan(23)' \ |
196
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
17 -f auth_tests.sql \ |
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
18 -f manage_users_tests.sql \ |
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
19 -c 'SELECT * FROM finish()' \ |
b67208d82543
Make test output more comprehensive
Tom Gottfried <tom@intevation.de>
parents:
185
diff
changeset
|
20 -c 'ROLLBACK' |