mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-24 17:36:39 +00:00
Allow database dumps to be restored in test suite.
Primary fix is the search_path to ensure that the collection table is in the search path so that the copy into dav_binding (and possibly others) will work. I also suppressed the warning about plpgsql.
This commit is contained in:
parent
b0a1c9212d
commit
95ad5ec373
@ -140,7 +140,16 @@ restore_database() {
|
||||
|
||||
dump_database() {
|
||||
TEST="Dump-Database"
|
||||
pg_dump -Fp $PSQLOPTS ${DBNAME} > "${REGRESSION}/initial.dbdump" 2>&1
|
||||
pg_dump -Fp $PSQLOPTS ${DBNAME} \
|
||||
| grep -v -E '(CREATE\ EXTENSION|COMMENT\ ON)' \
|
||||
> "${REGRESSION}/initial.dbdump" 2>&1
|
||||
|
||||
# This is ugly, for the COPY into dav_binding to work on Pg >= 9.6 (possibly earlier)
|
||||
# we need to ensure that the schema that collection is in is within our search path
|
||||
# since the function real_path_exists is called on each insert into dav_binding and
|
||||
# it doesn't specify the schema for 'collection', therefore the copy fails.
|
||||
schema=$(grep "CREATE TABLE .*.collection" "${REGRESSION}/initial.dbdump" | sed -r 's/CREATE TABLE (.*?)\.collection \(/\1/')
|
||||
sed -i "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', '$schema', false);/" "${REGRESSION}/initial.dbdump"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
psql:tests/binding/initial.dbdump:28: ERROR: must be owner of extension plpgsql
|
||||
set_config
|
||||
------------
|
||||
public
|
||||
(1 row)
|
||||
|
||||
setval
|
||||
--------
|
||||
1601
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
psql:tests/carddav/initial.dbdump:28: ERROR: must be owner of extension plpgsql
|
||||
set_config
|
||||
------------
|
||||
public
|
||||
(1 row)
|
||||
|
||||
setval
|
||||
--------
|
||||
1633
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
psql:tests/scheduling/initial.dbdump:28: ERROR: must be owner of extension plpgsql
|
||||
set_config
|
||||
------------
|
||||
public
|
||||
(1 row)
|
||||
|
||||
setval
|
||||
--------
|
||||
1648
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user