Skip to content

Commit 80236d1

Browse files
author
Colleen Murphy
committed
Fix acceptance tests from #641
1 parent 8dbe7c0 commit 80236d1

File tree

1 file changed

+54
-21
lines changed

1 file changed

+54
-21
lines changed

spec/acceptance/types/mysql_plugin_spec.rb

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,65 @@
11
require 'spec_helper_acceptance'
22

3-
describe 'mysql_plugin' do
4-
describe 'setup' do
5-
it 'should work with no errors' do
6-
pp = <<-EOS
7-
class { 'mysql::server': }
8-
EOS
9-
10-
apply_manifest(pp, :catch_failures => true)
3+
# Different operating systems (and therefore different versions/forks
4+
# of mysql) have varying levels of support for plugins and have
5+
# different plugins available. Choose a plugin that works or don't try
6+
# to test plugins if not available.
7+
if fact('osfamily') =~ /RedHat/
8+
if fact('operatingsystemrelease') =~ /^5\./
9+
plugin = nil # Plugins not supported on mysql on RHEL 5
10+
elsif fact('operatingsystemrelease') =~ /^6\./
11+
plugin = 'example'
12+
plugin_lib = 'ha_example.so'
13+
elsif fact('operatingsystemrelease') =~ /^7\./
14+
plugin = 'pam'
15+
plugin_lib = 'auth_pam.so'
16+
end
17+
elsif fact('osfamily') =~ /Debian/
18+
if fact('operatingsystem') =~ /Debian/
19+
if fact('operatingsystemrelease') =~ /^6\./
20+
# Only available plugin is innodb which is already loaded and not unload- or reload-able
21+
plugin = nil
22+
elsif fact('operatingsystemrelease') =~ /^7\./
23+
plugin = 'example'
24+
plugin_lib = 'ha_example.so'
1125
end
26+
elsif fact('operatingsystem') =~ /Ubuntu/
27+
plugin = 'example'
28+
plugin_lib = 'ha_example.so'
1229
end
30+
elsif fact('osfamily') =~ /Suse/
31+
plugin = nil # Plugin library path is broken on Suse http://lists.opensuse.org/opensuse-bugs/2013-08/msg01123.html
32+
end
1333

14-
describe 'load plugin' do
15-
it 'should work without errors' do
16-
pp = <<-EOS
17-
mysql_plugin { 'auth_socket':
18-
ensure => present,
19-
soname => 'auth_socket.so',
20-
}
21-
EOS
34+
describe 'mysql_plugin' do
35+
if plugin # if plugins are supported
36+
describe 'setup' do
37+
it 'should work with no errors' do
38+
pp = <<-EOS
39+
class { 'mysql::server': }
40+
EOS
2241

23-
apply_manifest(pp, :catch_failures => true)
42+
apply_manifest(pp, :catch_failures => true)
43+
end
2444
end
2545

26-
it 'should find the plugin' do
27-
shell("mysql -NBe \"select plugin_name from information_schema.plugins where plugin_name='auth_socket'\"") do |r|
28-
expect(r.stdout).to match(/^auth_socket$/)
29-
expect(r.stderr).to be_empty
46+
describe 'load plugin' do
47+
it 'should work without errors' do
48+
pp = <<-EOS
49+
mysql_plugin { #{plugin}:
50+
ensure => present,
51+
soname => '#{plugin_lib}',
52+
}
53+
EOS
54+
55+
apply_manifest(pp, :catch_failures => true)
56+
end
57+
58+
it 'should find the plugin' do
59+
shell("mysql -NBe \"select plugin_name from information_schema.plugins where plugin_name='#{plugin}'\"") do |r|
60+
expect(r.stdout).to match(/^#{plugin}$/i)
61+
expect(r.stderr).to be_empty
62+
end
3063
end
3164
end
3265
end

0 commit comments

Comments
 (0)