Description
Hi!
Is there a way to add a user to the postgres testcontainer during startup?
We want to run tests that assert row level security. The user set up for the testcontainer has the properties SUPERUSER and BYPASSRLS so it is not really suited for that type of testing. I would like to create another user for running the actual tests (or downgrade the user during tests, if possible?).
I've come across two ways of solving this in the Java implementation, but it does not seem to be available for the Scala version. One is by populating the database with the user with an init script.
new PostgreSQLContainer("postgres:12").withInitScript("db/init.sql")
Another suggestion is by copying a file to a folder that will be executed at startup. But this functionality also seems to be missing from the Scala implementation.
new PostgreSQLContainer("postgres:12")
.withCopyFileToContainer(
MountableFile.forClasspathResource("init.sql"),
"/docker-entrypoint-initdb.d/init.sql"
);
Is there another way?