-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add serverspec test, to verify that mysql listen on the good port whe…
…n changed
- Loading branch information
1 parent
082cc29
commit 6c0e4f9
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
package_server_name = 'mariadb-server-10.0' | ||
case backend.check_os[:family] | ||
when 'Fedora', 'CentOS', 'RedHat' | ||
package_server_name = 'MariaDB-server' | ||
end | ||
|
||
describe package(package_server_name) do | ||
it { should be_installed } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
require 'spec_helper' | ||
|
||
describe service('mysql') do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe port('3307') do | ||
it { should be_listening } | ||
end | ||
|
||
includedir = '/etc/mysql/conf.d' | ||
mysql_config_file = '/etc/mysql/my.cnf' | ||
case backend.check_os[:family] | ||
when 'Fedora', 'CentOS', 'RedHat' | ||
includedir = '/etc/my.cnf.d' | ||
mysql_config_file = '/etc/my.cnf' | ||
end | ||
|
||
describe "verify the tuning attributes set in #{mysql_config_file}" do | ||
{ | ||
query_cache_size: '64M', | ||
thread_cache_size: 128, | ||
max_connections: 100, | ||
wait_timeout: 600, | ||
max_heap_table_size: '32M', | ||
read_buffer_size: '2M', | ||
read_rnd_buffer_size: '1M', | ||
long_query_time: 10, | ||
key_buffer_size: '128M', | ||
max_allowed_packet: '16M', | ||
sort_buffer_size: '4M', | ||
myisam_sort_buffer_size: '512M' | ||
}.each do |attribute, value| | ||
describe command("grep -E \"^#{attribute}\\s+\" #{mysql_config_file}") do | ||
it { should return_stdout(/#{value}/) } | ||
end | ||
end | ||
end | ||
|
||
describe 'verify the tuning attributes set in ' + includedir + '/innodb.cnf' do | ||
{ | ||
innodb_buffer_pool_size: '256M', | ||
innodb_flush_method: 'O_DIRECT', | ||
innodb_file_per_table: 1, | ||
innodb_open_files: 400 | ||
}.each do |attribute, value| | ||
describe command("grep -E \"^#{attribute}\\s+\" " \ | ||
"#{includedir}/innodb.cnf") do | ||
it { should return_stdout(/#{value}/) } | ||
end | ||
end | ||
end | ||
|
||
describe 'verify the tuning attributes set in ' \ | ||
+ includedir + '/replication.cnf' do | ||
{ | ||
max_binlog_size: '100M', | ||
expire_logs_days: 10 | ||
}.each do |attribute, value| | ||
describe command("grep -E \"^#{attribute}\\s+\" " \ | ||
"#{includedir}/replication.cnf") do | ||
it { should return_stdout(/#{value}/) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require 'serverspec' | ||
|
||
include Serverspec::Helper::Exec | ||
include Serverspec::Helper::DetectOS |