fix restore if database does not exists

This commit is contained in:
Jörg Thalheim
2024-06-14 11:48:42 +02:00
parent ad544a7d24
commit c79680344d
2 changed files with 9 additions and 1 deletions

View File

@@ -63,5 +63,10 @@
output = machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql --csv -c \"SELECT datdba::regrole FROM pg_database WHERE datname = 'test'\"")
owner = output.split("\n")[1]
assert owner == "test", f"Expected database owner to be 'test', got '{owner}'"
# check if restore works if the database does not exist
machine.succeed("runuser -u postgres -- dropdb test")
machine.succeed("${nodes.machine.clanCore.state.postgresql-test.postRestoreCommand}")
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -d test -c '\dt' >&2")
'';
})