-
Notifications
You must be signed in to change notification settings - Fork 549
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
Fix test that implicitly creates a passwordless user #669
Fix test that implicitly creates a passwordless user #669
Conversation
@@ -200,7 +200,7 @@ def run_gc | |||
it "should be able to connect to database with numeric-only name" do | |||
creds = DatabaseCredentials['numericuser'] | |||
@client.query "CREATE DATABASE IF NOT EXISTS `#{creds['database']}`" | |||
@client.query "GRANT ALL ON `#{creds['database']}`.* TO #{creds['username']}@`#{creds['host']}`" | |||
@client.query "GRANT ALL ON `#{creds['database']}`.* TO #{creds['username']}@`#{creds['host']}` IDENTIFIED BY '#{creds['password']}'" |
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 looks good
ac2c2dc
to
48f2164
Compare
@@ -7,11 +7,11 @@ root: | |||
user: | |||
host: localhost | |||
username: LOCALUSERNAME | |||
password: | |||
password: test |
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.
The default travis
user has no password: http://docs.travis-ci.com/user/database-setup/#MySQL
I'm not sure how the tests pass with this change?
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.
These config are only for specs. We only connect as root
.
In fact, the user
config is unused and, according to git history, has never been used!
IMO the numericuser
config is inappropriate here too. The spec should use the same config and just change the db name to a numeric one.
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.
Updated to drop the unused toplevel db configs. The numeric-db spec should just create the numeric db using the main test db creds. Much simpler!
When the MySQL server has NO_AUTO_CREATE_USER, a GRANT can't implicitly create a user unless a password is specified. To fix, just provide a dummy password in the example db config and update the GRANT.
…in the spec. Drop the never-used 'user' db config.
48f2164
to
a08b491
Compare
Resolved by 39901da |
When the MySQL server has
NO_AUTO_CREATE_USER
, a GRANT can't implicitlycreate a user unless a password is specified. To fix, just provide a
dummy password in the example db config and update the GRANT.