|
2 | 2 | require 'puppet/type/mysql_user'
|
3 | 3 | describe Puppet::Type.type(:mysql_user) do
|
4 | 4 |
|
5 |
| - it 'should fail with a long user name' do |
6 |
| - expect { |
7 |
| - Puppet::Type.type(:mysql_user).new({:name => '12345678901234567@localhost', :password_hash => 'pass'}) |
8 |
| - }.to raise_error /MySQL usernames are limited to a maximum of 16 characters/ |
| 5 | + context "On MySQL 5.x" do |
| 6 | + let(:facts) {{ :mysql_version => '5.6.24' }} |
| 7 | + it 'should fail with a long user name' do |
| 8 | + expect { |
| 9 | + Puppet::Type.type(:mysql_user).new({:name => '12345678901234567@localhost', :password_hash => 'pass'}) |
| 10 | + }.to raise_error /MySQL usernames are limited to a maximum of 16 characters/ |
| 11 | + end |
| 12 | + end |
| 13 | + |
| 14 | + context "On MariaDB 10.0.0+" do |
| 15 | + let(:facts) {{ :mysql_version => '10.0.19' }} |
| 16 | + it 'should succeed with a long user name on MariaDB' do |
| 17 | + expect { |
| 18 | + Puppet::Type.type(:mysql_user).new({:name => '12345678901234567@localhost', :password_hash => 'pass'}) |
| 19 | + }.to raise_error /MySQL usernames are limited to a maximum of 16 characters/ |
| 20 | + end |
9 | 21 | end
|
10 | 22 |
|
11 | 23 | it 'should require a name' do
|
|
60 | 72 | end
|
61 | 73 |
|
62 | 74 | context 'using a quoted 16 char username' do
|
| 75 | + let(:facts) {{ :mysql_version => '5.6.24' }} |
63 | 76 | before :each do
|
64 | 77 | @user = Puppet::Type.type(:mysql_user).new(:name => '"debian-sys-maint"@localhost', :password_hash => 'pass')
|
65 | 78 | end
|
|
70 | 83 | end
|
71 | 84 |
|
72 | 85 | context 'using a quoted username that is too long ' do
|
| 86 | + let(:facts) {{ :mysql_version => '5.6.24' }} |
73 | 87 | it 'should fail with a size error' do
|
74 | 88 | expect {
|
75 | 89 | Puppet::Type.type(:mysql_user).new(:name => '"debian-sys-maint2"@localhost', :password_hash => 'pass')
|
|
0 commit comments