You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
morkonom
changed the title
Using another user for the posgres testcontainer
Using another user for the postgres testcontainer
Nov 8, 2024
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.
Is there another way?
The text was updated successfully, but these errors were encountered: