Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[request] Downgrade role after test fixtures loaded #33

Open
mlt opened this issue Jul 13, 2019 · 2 comments
Open

[request] Downgrade role after test fixtures loaded #33

mlt opened this issue Jul 13, 2019 · 2 comments

Comments

@mlt
Copy link
Contributor

mlt commented Jul 13, 2019

Here is another idea... It is a known limitation that test environment has to use PostgreSQL superuser to be able to disable/enable triggers on fixtures loading.
I think it would be very nice if we could also issue set role ... to something configurable and reset role at appropriate time. This way we can test things as they are meant to be tested with normal unprivileged user.

mlt added a commit to mlt/rails that referenced this issue Jul 14, 2019
In your test environment config, put something like
config.test_role = :your_frontend_db_role

crashtech/torque-postgresql#33
mlt added a commit to mlt/torque-postgresql that referenced this issue Jul 19, 2019
mlt added a commit to mlt/torque-postgresql that referenced this issue Jul 19, 2019
@crashtech
Copy link
Owner

But I didn't get the idea. Why you need another role/account when inserting fixtures?
You can always define a new connection setting and ensure that is used when your fixtures are loaded.

@mlt
Copy link
Contributor Author

mlt commented Aug 12, 2019

Maybe I am missing something. All I know is that superuser has to be used to successfully disable referential integrity. And I want to use actual role while testing to make sure default privileges are in effects etc. How would I specify a different connection to load fixtures after all triggers are disabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants