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

Fix test that implicitly creates a passwordless user #669

Closed

Conversation

jeremy
Copy link
Contributor

@jeremy jeremy commented Sep 7, 2015

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.

@sodabrew sodabrew added this to the 0.4.1 milestone Sep 8, 2015
@@ -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']}'"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good

@jeremy jeremy force-pushed the fix-grant-with-no-auto-create-user branch from ac2c2dc to 48f2164 Compare September 14, 2015 04:49
@@ -7,11 +7,11 @@ root:
user:
host: localhost
username: LOCALUSERNAME
password:
password: test
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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!

@sodabrew sodabrew modified the milestones: 0.4.1, 0.4.2 Sep 15, 2015
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.
@jeremy jeremy force-pushed the fix-grant-with-no-auto-create-user branch from 48f2164 to a08b491 Compare September 16, 2015 14:53
@sodabrew sodabrew modified the milestones: 0.4.2, 0.4.3 Nov 22, 2015
@sodabrew sodabrew modified the milestones: 0.4.3, 0.4.4 Feb 24, 2016
@sodabrew sodabrew modified the milestones: 0.4.4, 0.4.5 Mar 6, 2016
@sodabrew sodabrew modified the milestones: 0.4.5, 0.5.0 Oct 22, 2016
@sodabrew
Copy link
Collaborator

Resolved by 39901da

@sodabrew sodabrew closed this Oct 22, 2016
@sodabrew sodabrew modified the milestones: 0.4.5, 0.5.0 Oct 22, 2016
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

Successfully merging this pull request may close these issues.

2 participants