module-puppetlabs-mysql/spec/acceptance/mysql_bindings_spec.rb
Hunter Haugen 0aed9e07f7 Adding beaker-rspec test files
These tests are more or less parity with the rspec-system tests, though
dependent on a few patches that still have to make it into beaker and
beaker-rspec
2013-12-06 14:52:41 -08:00

87 lines
2.2 KiB
Ruby

require 'spec_helper_acceptance'
describe 'mysql::bindings class' do
osfamily = fact('osfamily')
operatingsystem = fact('operatingsystem')
case osfamily
when 'RedHat'
java_package = 'mysql-connector-java'
perl_package = 'perl-DBD-MySQL'
python_package = 'MySQL-python'
ruby_package = 'ruby-mysql'
when 'Suse'
java_package = 'mysql-connector-java'
perl_package = 'perl-DBD-MySQL'
python_package = 'python-mysql'
case operatingsystem
when /OpenSuSE/
ruby_package = 'rubygem-mysql'
when /(SLES|SLED)/
ruby_package = 'ruby-mysql'
end
when 'Debian'
java_package = 'libmysql-java'
perl_package = 'libdbd-mysql-perl'
python_package = 'python-mysqldb'
ruby_package = 'libmysql-ruby'
when 'FreeBSD'
java_package = 'databases/mysql-connector-java'
perl_package = 'p5-DBD-mysql'
python_package = 'databases/py-MySQLdb'
ruby_package = 'ruby-mysql'
else
case operatingsystem
when 'Amazon'
java_package = 'mysql-connector-java'
perl_package = 'perl-DBD-MySQL'
python_package = 'MySQL-python'
ruby_package = 'ruby-mysql'
end
end
describe 'running puppet code' do
it 'should work with no errors' do
pp = <<-EOS
class { 'mysql::bindings': }
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
end
end
describe 'enabling bindings' do
it 'should work with no errors' do
pp = <<-EOS
class { 'mysql::bindings':
java_enable => true,
perl_enable => true,
python_enable => true,
ruby_enable => true,
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
end
describe package(java_package) do
it { should be_installed }
end
describe package(perl_package) do
it { should be_installed }
end
describe package(python_package) do
it { should be_installed }
end
describe package(ruby_package) do
it { should be_installed }
end
end
end