Skip to content

Commit

Permalink
Initial attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
khashf committed May 15, 2019
1 parent 03e4ade commit fb3f11c
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 90 deletions.
2 changes: 2 additions & 0 deletions .kitchen.yml
@@ -1,4 +1,6 @@
---
verifier:
name: inspec
driver:
flavor_ref: 'm1.medium'
provisioner:
Expand Down
6 changes: 6 additions & 0 deletions test/integration/backup/inspec/backup_spec.rb
@@ -0,0 +1,6 @@
describe file('/data/backup') do
it { should be_directory }
its('mode') { should cmp 0700 }
its('owner') { should eq 'root' }
its('group') { should eq 'root' }
end
10 changes: 0 additions & 10 deletions test/integration/backup/serverspec/backup_spec.rb

This file was deleted.

@@ -1,7 +1,3 @@
require 'serverspec'

set :backend, :exec

if os[:family] == 'redhat' && os[:release].to_i == 7
describe package 'mariadb' do
it { should be_installed }
Expand Down
59 changes: 59 additions & 0 deletions test/integration/mon/inspec/mon_spec.rb
@@ -0,0 +1,59 @@
describe file('/etc/nagios/mysql.cnf') do
its('content') { should match(/user = monitor/) }
its('content') { should match(/password = ToJzwUyqQmyV4GgMVpz0/) }
its('mode') { should cmp 0600 }
its('owner') { should eq 'nrpe' }
its('group') { should eq 'nrpe' }
end

%w(
innodb
pidfile
processlist
replication-delay
).each do |p|
describe file("/etc/nagios/nrpe.d/pmp-check-mysql-#{p}.cfg") do
its('content') do
should match(%r{command\[pmp-check-mysql-#{p}\]=\/usr/lib64/nagios/plugins/pmp-check-mysql-#{p}})
end
end
describe command("/usr/lib64/nagios/plugins/pmp-check-mysql-#{p}") do
its('stdout') { should match(/^OK/) }
its('exit_status') { should eq 0 }
end
end

describe file('/etc/munin/plugin-conf.d/mysql') do
its('content') { should match(/env.mysqluser monitor/) }
its('content') { should match(/env.mysqlpassword ToJzwUyqQmyV4GgMVpz0/) }
its('mode') { should cmp 0600 }
its('owner') { should eq 'munin' }
its('group') { should eq 'munin' }
end

# bin_relay_log
# is excluded from here since it doesn't work
# for a single-node mysql installation
%w(
commands
connections
innodb_bpool
innodb_bpool_act
innodb_semaphores
qcache
qcache_mem
queries
slow
slowqueries
table_locks
threads
tmp_tables
).each do |p|
describe command("/usr/sbin/munin-run mysql_#{p}") do
its('exit_status') { should eq 0 }
end
end

describe command('/usr/local/libexec/mysql-accounting') do
its('exit_status') { should eq 0 }
end
64 changes: 0 additions & 64 deletions test/integration/mon/serverspec/mon_spec.rb

This file was deleted.

2 changes: 1 addition & 1 deletion test/integration/provisioning/destroy_all.rb
@@ -1,4 +1,4 @@
require 'chef/provisioning'
# require 'chef/provisioning'

machine_batch do
machines search(:node, '*:*').map(&:name)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/provisioning/master_slave.rb
@@ -1,5 +1,5 @@
require 'chef/provisioning'
require 'chef/provisioning/vagrant_driver'
# require 'chef/provisioning'
# require 'chef/provisioning/vagrant_driver'

with_driver "vagrant:#{File.dirname(__FILE__)}/../../../vms"

Expand Down
@@ -1,7 +1,3 @@
require 'serverspec'

set :backend, :exec

%w(
Percona-Server-server-56
Percona-Server-devel-56
Expand Down Expand Up @@ -36,16 +32,16 @@

describe file('/root/.my.cnf') do
it { should be_file }
its(:content) { should match(/jzYY0cQUnPAMcqvIxYaC/) }
its('content') { should match(/jzYY0cQUnPAMcqvIxYaC/) }
end

describe command('sysctl vm.swappiness') do
its(:stdout) { should match(/vm.swappiness = 0/) }
its(:exit_status) { should eq 0 }
its('stdout') { should match(/vm.swappiness = 0/) }
its('exit_status') { should eq 0 }
end

describe file('/etc/sysctl.d/99-chef-vm.swappiness.conf') do
its(:content) { should match(/vm.swappiness = 0/) }
its('content') { should match(/vm.swappiness = 0/) }
end

describe yumrepo('percona-noarch') do
Expand All @@ -61,7 +57,7 @@
end

describe command('/usr/local/libexec/mysql-accounting') do
its(:exit_status) { should eq 0 }
its('exit_status') { should eq 0 }
end

describe command('/usr/local/libexec/mysql-prometheus') do
Expand Down

0 comments on commit fb3f11c

Please sign in to comment.