-
-
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.
Merge pull request #26 from Ecodev/move_datadir
[Feature] Move datadir after install (issue #25)
- Loading branch information
Showing
8 changed files
with
143 additions
and
5 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
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
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,2 @@ | ||
source 'https://rubygems.org' | ||
gem 'serverspec', '< 2.0' |
11 changes: 11 additions & 0 deletions
11
test/integration/datadir_changed/serverspec/install_spec.rb
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 |
75 changes: 75 additions & 0 deletions
75
test/integration/datadir_changed/serverspec/mariadb_spec.rb
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,75 @@ | ||
require 'spec_helper' | ||
|
||
describe service('mysql') do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe port('3306') 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 | ||
|
||
describe 'verify that the datadir was moved' do | ||
describe file('/home/mysql') do | ||
it { should be_directory } | ||
end | ||
describe file('/var/lib/mysql') do | ||
it { should be_linked_to '/home/mysql' } | ||
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 |