Sha256: 7821f1455b8e8bd7151e0dd8b527bb4232e9919d2122c1d18b0881f4660226f4

Contents?: true

Size: 1.37 KB

Versions: 7

Compression:

Stored size: 1.37 KB

Contents

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
freighthop-0.6.1 modules/mysql/spec/system/mysql_server_root_password_spec.rb
freighthop-0.6.0 modules/mysql/spec/system/mysql_server_root_password_spec.rb
freighthop-0.5.2 modules/mysql/spec/system/mysql_server_root_password_spec.rb
freighthop-0.5.1 modules/mysql/spec/system/mysql_server_root_password_spec.rb
freighthop-0.5.0 modules/mysql/spec/system/mysql_server_root_password_spec.rb
freighthop-0.4.1 modules/mysql/spec/system/mysql_server_root_password_spec.rb
freighthop-0.4.0 modules/mysql/spec/system/mysql_server_root_password_spec.rb