-
Notifications
You must be signed in to change notification settings - Fork 125
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
Handle cases where the database connection does not use a password #763
Conversation
users_and_passwords = ActiveRecord::Base.connection.execute <<-SQL | ||
SELECT rolname, rolpassword FROM pg_authid WHERE rolcanlogin; | ||
SQL | ||
expect(ActiveRecord::Base.connection_db_config).to receive(:configuration_hash).exactly(10).times.and_call_original |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an interesting find. It feels a little fragile to me, anyone have a better idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't love adding "real" code only to support tests, but maybe worth it in this case. You could add a method that returns the connection_db_config in the migration class and stub that method in this spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exactly 10 times as opposed to something like at least once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing because on the 11th time he needs to return a different payload
@miq-bot cross-repo-test manageiq, manageiq-ui-classic, manageiq-api |
From Pull Request: ManageIQ/manageiq-schema#763
I'm going to merge this to unstick the rest of the repositories but I think it's worth looking into a better way to test this. |
Backported to
|
Handle cases where the database connection does not use a password (cherry picked from commit 6c25437)
Introduced in #757