Merge pull request #859 from tphoney/user_unit_test_fix
fixing the failing unit tests for mysql_user
This commit is contained in:
commit
2928c66268
1 changed files with 12 additions and 7 deletions
|
@ -3,7 +3,9 @@ require 'puppet/type/mysql_user'
|
||||||
describe Puppet::Type.type(:mysql_user) do
|
describe Puppet::Type.type(:mysql_user) do
|
||||||
|
|
||||||
context "On MySQL 5.x" 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
|
it 'should fail with a long user name' do
|
||||||
expect {
|
expect {
|
||||||
Puppet::Type.type(:mysql_user).new({:name => '12345678901234567@localhost', :password_hash => 'pass'})
|
Puppet::Type.type(:mysql_user).new({:name => '12345678901234567@localhost', :password_hash => 'pass'})
|
||||||
|
@ -12,11 +14,12 @@ describe Puppet::Type.type(:mysql_user) do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "On MariaDB 10.0.0+" do
|
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
|
it 'should succeed with a long user name on MariaDB' do
|
||||||
expect {
|
expect(@user[:name]).to eq('12345678901234567@localhost')
|
||||||
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/
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,7 +85,6 @@ describe Puppet::Type.type(:mysql_user) do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'using a quoted 16 char username' do
|
context 'using a quoted 16 char username' do
|
||||||
let(:facts) {{ :mysql_version => '5.6.24' }}
|
|
||||||
before :each do
|
before :each do
|
||||||
@user = Puppet::Type.type(:mysql_user).new(:name => '"debian-sys-maint"@localhost', :password_hash => 'pass')
|
@user = Puppet::Type.type(:mysql_user).new(:name => '"debian-sys-maint"@localhost', :password_hash => 'pass')
|
||||||
end
|
end
|
||||||
|
@ -93,7 +95,10 @@ describe Puppet::Type.type(:mysql_user) do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'using a quoted username that is too long ' do
|
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
|
it 'should fail with a size error' do
|
||||||
expect {
|
expect {
|
||||||
Puppet::Type.type(:mysql_user).new(:name => '"debian-sys-maint2"@localhost', :password_hash => 'pass')
|
Puppet::Type.type(:mysql_user).new(:name => '"debian-sys-maint2"@localhost', :password_hash => 'pass')
|
||||||
|
|
Loading…
Reference in a new issue