Postgres Templates
# spicedb
l
has anyone experimented with using spicedb on top of postgres and using pg's templates for quickly restoring to a known state while doing integration tests?
y
not that i know of, but i'd be surprised if it worked. are templates more or less equivalent to
pg_dump
and
pg_restore
?
also, what are you referring to with "integration tests?" is it just app tests that hit a spicedb instance, or are they tests that are supposed to reflect "real world" data?
l
any time "create database" is executed it uses a template under the hood. https://www.postgresql.org/docs/current/manage-ag-templatedbs.html i haven't played with spicedb yet so this is a very zero-context question.
y
the canonical way to do it is with
zed import
or with the
BulkImport
gRPC method. i'd also recommend running spicedb in testing mode when you're doing integration tests (
spicedb serve-testing
), as it gives you neatly sandboxed test spaces without you needing to do much else.
which is to say I wouldn't use postgres at all for tests
l
👍 much appreciated