Merge pull request #301 from apenney/root_password_spec
Add testing for mysql::server::root_password.
This commit is contained in:
commit
45d734b050
1 changed files with 65 additions and 0 deletions
65
spec/system/mysql_server_root_password_spec.rb
Normal file
65
spec/system/mysql_server_root_password_spec.rb
Normal file
|
@ -0,0 +1,65 @@
|
|||
require 'spec_helper_system'
|
||||
|
||||
describe 'mysql::server::root_password class' do
|
||||
|
||||
describe 'reset' do
|
||||
it 'shuts down mysql' do
|
||||
pp = <<-EOS
|
||||
class { 'mysql::server': service_enabled => false }
|
||||
EOS
|
||||
|
||||
puppet_apply(pp) do |r|
|
||||
r.exit_code.should_not == 1
|
||||
end
|
||||
end
|
||||
|
||||
it 'deletes the /root/.my.cnf password' do
|
||||
shell('rm -rf /root/.my.cnf')
|
||||
end
|
||||
|
||||
it 'deletes all databases' do
|
||||
shell('rm -rf `grep datadir /etc/my.cnf | cut -d" " -f 3`/*')
|
||||
end
|
||||
|
||||
it 'starts up mysql' do
|
||||
pp = <<-EOS
|
||||
class { 'mysql::server': service_enabled => true }
|
||||
EOS
|
||||
|
||||
puppet_apply(pp) do |r|
|
||||
r.exit_code.should_not == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when unset' do
|
||||
it 'should work' do
|
||||
pp = <<-EOS
|
||||
class { 'mysql::server': root_password => 'test' }
|
||||
EOS
|
||||
|
||||
# Run it twice and test for idempotency
|
||||
puppet_apply(pp) do |r|
|
||||
r.exit_code.should_not == 1
|
||||
r.refresh
|
||||
r.exit_code.should be_zero
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when set' do
|
||||
it 'should work' do
|
||||
pp = <<-EOS
|
||||
class { 'mysql::server': root_password => 'new', old_root_password => 'test' }
|
||||
EOS
|
||||
|
||||
# Run it twice and test for idempotency
|
||||
puppet_apply(pp) do |r|
|
||||
r.exit_code.should_not == 1
|
||||
r.refresh
|
||||
r.exit_code.should be_zero
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue