Skip to content

Fix acceptance tests from #641 #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 54 additions & 21 deletions spec/acceptance/types/mysql_plugin_spec.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,65 @@
require 'spec_helper_acceptance'

describe 'mysql_plugin' do
describe 'setup' do
it 'should work with no errors' do
pp = <<-EOS
class { 'mysql::server': }
EOS

apply_manifest(pp, :catch_failures => true)
# Different operating systems (and therefore different versions/forks
# of mysql) have varying levels of support for plugins and have
# different plugins available. Choose a plugin that works or don't try
# to test plugins if not available.
if fact('osfamily') =~ /RedHat/
if fact('operatingsystemrelease') =~ /^5\./
plugin = nil # Plugins not supported on mysql on RHEL 5
elsif fact('operatingsystemrelease') =~ /^6\./
plugin = 'example'
plugin_lib = 'ha_example.so'
elsif fact('operatingsystemrelease') =~ /^7\./
plugin = 'pam'
plugin_lib = 'auth_pam.so'
end
elsif fact('osfamily') =~ /Debian/
if fact('operatingsystem') =~ /Debian/
if fact('operatingsystemrelease') =~ /^6\./
# Only available plugin is innodb which is already loaded and not unload- or reload-able
plugin = nil
elsif fact('operatingsystemrelease') =~ /^7\./
plugin = 'example'
plugin_lib = 'ha_example.so'
end
elsif fact('operatingsystem') =~ /Ubuntu/
plugin = 'example'
plugin_lib = 'ha_example.so'
end
elsif fact('osfamily') =~ /Suse/
plugin = nil # Plugin library path is broken on Suse http://lists.opensuse.org/opensuse-bugs/2013-08/msg01123.html
end

describe 'load plugin' do
it 'should work without errors' do
pp = <<-EOS
mysql_plugin { 'auth_socket':
ensure => present,
soname => 'auth_socket.so',
}
EOS
describe 'mysql_plugin' do
if plugin # if plugins are supported
describe 'setup' do
it 'should work with no errors' do
pp = <<-EOS
class { 'mysql::server': }
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_failures => true)
end
end

it 'should find the plugin' do
shell("mysql -NBe \"select plugin_name from information_schema.plugins where plugin_name='auth_socket'\"") do |r|
expect(r.stdout).to match(/^auth_socket$/)
expect(r.stderr).to be_empty
describe 'load plugin' do
it 'should work without errors' do
pp = <<-EOS
mysql_plugin { #{plugin}:
ensure => present,
soname => '#{plugin_lib}',
}
EOS

apply_manifest(pp, :catch_failures => true)
end

it 'should find the plugin' do
shell("mysql -NBe \"select plugin_name from information_schema.plugins where plugin_name='#{plugin}'\"") do |r|
expect(r.stdout).to match(/^#{plugin}$/i)
expect(r.stderr).to be_empty
end
end
end
end
Expand Down