Skip to content

Commit

Permalink
fixing the failing unit tests for mysql_user
Browse files Browse the repository at this point in the history
  • Loading branch information
tphoney committed Jun 21, 2016
1 parent 7370716 commit f183e49
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions spec/unit/puppet/type/mysql_user_spec.rb
Expand Up @@ -3,7 +3,9 @@
describe Puppet::Type.type(:mysql_user) do

context "On MySQL 5.x" do
let(:facts) {{ :mysql_version => '5.6.24' }}
before :each do
Facter.stubs(:value).with(:mysql_version).returns("5.6.24")
end
it 'should fail with a long user name' do
expect {
Puppet::Type.type(:mysql_user).new({:name => '12345678901234567@localhost', :password_hash => 'pass'})
Expand All @@ -12,11 +14,12 @@
end

context "On MariaDB 10.0.0+" do
let(:facts) {{ :mysql_version => '10.0.19' }}
before :each do
Facter.stubs(:value).with(:mysql_version).returns("10.0.19")
@user = Puppet::Type.type(:mysql_user).new(:name => '12345678901234567@localhost', :password_hash => 'pass')
end
it 'should succeed with a long user name on MariaDB' do
expect {
Puppet::Type.type(:mysql_user).new({:name => '12345678901234567@localhost', :password_hash => 'pass'})
}.to raise_error /MySQL usernames are limited to a maximum of 16 characters/
expect(@user[:name]).to eq('12345678901234567@localhost')
end
end

Expand Down Expand Up @@ -82,7 +85,6 @@
end

context 'using a quoted 16 char username' do
let(:facts) {{ :mysql_version => '5.6.24' }}
before :each do
@user = Puppet::Type.type(:mysql_user).new(:name => '"debian-sys-maint"@localhost', :password_hash => 'pass')
end
Expand All @@ -93,7 +95,10 @@
end

context 'using a quoted username that is too long ' do
let(:facts) {{ :mysql_version => '5.6.24' }}
before :each do
Facter.stubs(:value).with(:mysql_version).returns("5.6.24")
end

it 'should fail with a size error' do
expect {
Puppet::Type.type(:mysql_user).new(:name => '"debian-sys-maint2"@localhost', :password_hash => 'pass')
Expand Down

0 comments on commit f183e49

Please sign in to comment.