Skip to content

Commit 5959e5d

Browse files
committed
resolved feedback
1 parent a07b6f0 commit 5959e5d

File tree

4 files changed

+41
-14
lines changed

4 files changed

+41
-14
lines changed

spec/acceptance/locales_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper_acceptance'
22
require 'beaker/i18n_helper'
33

4-
describe 'mysql localization', if: (os[:family] == 'Debian' || os[:family] == 'Redhat') && (Gem::Version.new(puppet_version) >= Gem::Version.new('4.10.5')) do
4+
describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && (Gem::Version.new(puppet_version) >= Gem::Version.new('4.10.5')) do
55
before :all do
66
hosts.each do |host|
77
on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb")
@@ -12,7 +12,7 @@
1212
context 'when triggering puppet simple string error' do
1313
# 'service_enabled' being set to false can cause random failures in Debian 9
1414
let(:os_variant) do
15-
if os[:release] =~ %r{Debian} && os[:release] =~ %r{^9\.}
15+
if os[:family] == 'debian' && os[:release].to_i == '9'
1616
'true'
1717
else
1818
'false'
@@ -76,7 +76,7 @@ class { 'mysql::server::backup':
7676
host => 'localhost',
7777
grant => ['SELECT', 'UPDATE'],
7878
}
79-
MANIFEST
79+
MANIFEST
8080
end
8181

8282
it 'displays Japanese failure' do

spec/acceptance/mysql_server_spec.rb

+13-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
<<-MANIFEST
77
class { 'mysql::server':
88
manage_config_file => 'true',
9-
#override_options => { 'mysqld' => { 'key_buffer_size' => '32M' }},
10-
override_options => { 'mysqld' => { 'log-error' => undef }, 'mysqld_safe' => { 'log-error' => false, 'syslog' => true }},
9+
override_options => { 'mysqld' => { 'key_buffer_size' => '32M' }},
1110
package_ensure => 'present',
1211
purge_conf_dir => 'true',
1312
remove_default_accounts => 'true',
@@ -47,6 +46,18 @@ class { 'mysql::server':
4746
it_behaves_like 'a idempotent resource'
4847
end
4948

49+
describe 'syslog configuration' do
50+
let(:pp) do
51+
<<-MANIFEST
52+
class { 'mysql::server':
53+
override_options => { 'mysqld' => { 'log-error' => undef }, 'mysqld_safe' => { 'log-error' => false, 'syslog' => true }},
54+
}
55+
MANIFEST
56+
end
57+
58+
it_behaves_like 'a idempotent resource'
59+
end
60+
5061
context 'when changing the password' do
5162
let(:password) { 'THE NEW SECRET' }
5263
let(:pp) { "class { 'mysql::server': root_password => '#{password}' }" }

spec/acceptance/types/mysql_plugin_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
# of mysql) have varying levels of support for plugins and have
55
# different plugins available. Choose a plugin that works or don't try
66
# to test plugins if not available.
7-
if os[:family] =~ %r{Redhat}
8-
if os[:release] =~ %r{^5\.}
7+
if fact('osfamily') == 'RedHat'
8+
if os[:release].to_i == '5'
99
plugin = nil # Plugins not supported on mysql on RHEL 5
10-
elsif os[:release] =~ %r{^6\.}
10+
elsif os[:release].to_i == '6'
1111
plugin = 'example'
1212
plugin_lib = 'ha_example.so'
13-
elsif os[:release] =~ %r{^7\.}
13+
elsif os[:release].to_i == '7'
1414
plugin = 'pam'
1515
plugin_lib = 'auth_pam.so'
1616
end
17-
elsif os[:family] =~ %r{Debian}
18-
if os[:release] =~ %r{Ubuntu}
17+
elsif fact('osfamily') == 'Debian'
18+
if fact('operatingsystem') =~ %r{Ubuntu}
1919
if os[:release] =~ %r{^16\.04|^18\.04}
2020
# On Xenial running 5.7.12, the example plugin does not appear to be available.
2121
plugin = 'validate_password'
@@ -25,8 +25,8 @@
2525
plugin_lib = 'ha_example.so'
2626
end
2727
end
28-
elsif os[:family] =~ %r{Suse}
29-
plugin = nil # Plugin library path is broken on Suse http://lists.opensuse.org/opensuse-bugs/2013-08/msg01123.html
28+
elsif fact('osfamily') == 'Suse'
29+
plugin = nil # Plugin library path is broken on Suse ttp://lists.opensuse.org/opensuse-bugs/2013-08/msg01123.html
3030
end
3131

3232
describe 'mysql_plugin' do

spec/spec_helper_acceptance.rb

+17-1
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,29 @@ def idempotent_apply(hosts, manifest, opts = {}, &block)
3636

3737
# detect the situation where PUP-5016 is triggered and skip the idempotency tests in that case
3838
# also note how fact('puppetversion') is not available because of PUP-4359
39-
if os[:family] == 'Debian' && os[:release] == '8' && shell('puppet --version').stdout =~ %r{^4\.2}
39+
if fact('osfamily') == 'Debian' && os[:release].to_i == '8' && shell('puppet --version').stdout =~ %r{^4\.2}
4040
c.filter_run_excluding skip_pup_5016: true
4141
end
4242

4343
# Configure all nodes in nodeset
4444
c.before :suite do
4545
run_puppet_access_login(user: 'admin') if pe_install? && (Gem::Version.new(puppet_version) >= Gem::Version.new('5.0.0'))
46+
hosts.each do |host|
47+
# This will be removed, this is temporary to test localisation.
48+
49+
if fact('osfamily') == 'Debian'
50+
# install language on debian systems
51+
install_language_on(host, 'ja_JP.utf-8') if not_controller(host)
52+
# This will be removed, this is temporary to test localisation.
53+
end
54+
# Required for binding tests.
55+
if fact('osfamily') == 'RedHat'
56+
if os[:release].to_i == '7' || os[:family] == 'fedora'
57+
shell('yum install -y bzip2')
58+
end
59+
end
60+
on host, puppet('module', 'install', 'stahnma/epel')
61+
end
4662
end
4763
end
4864

0 commit comments

Comments
 (0)