add mysql unit tests

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
Dominik Richter 2015-09-10 11:20:06 +02:00
parent 58fa9bc6c7
commit ddbaebae46
4 changed files with 28 additions and 1 deletions

View file

@ -12,6 +12,7 @@ SimpleCov.start do
end
require 'vulcano/backend'
require 'vulcano/resource'
# loads a resource class and instantiates the class with the given arguments
def loadResource (resource, *args)
@ -40,7 +41,9 @@ def loadResource (resource, *args)
'/etc/security/limits.conf' => mockfile.('limits.conf'),
'/etc/inetd.conf' => mockfile.('inetd.conf'),
'/etc/group' => mockfile.('group'),
'/etc/audit/auditd.conf' => mockfile.('auditd.conf')
'/etc/audit/auditd.conf' => mockfile.('auditd.conf'),
'/etc/mysql/my.cnf' => mockfile.('mysql.conf'),
'/etc/mysql/mysql2.conf' => mockfile.('mysql2.conf')
}
# create all mock commands

View file

@ -0,0 +1,8 @@
# a comment...
[client]
port = 3306
[mysqld]
user = mysql
!include mysql2.conf

View file

@ -0,0 +1,2 @@
[mysqld]
key_buffer_size=16M

View file

@ -0,0 +1,14 @@
# encoding: utf-8
require 'helper'
describe 'Vulcano::Resources::MysqlConf' do
describe 'mysql_conf' do
let(:resource) { loadResource('mysql_conf', '/etc/mysql/my.cnf') }
it 'verify mysql.conf config parsing' do
_(resource.client['port']).must_equal '3306'
_(resource.mysqld['user']).must_equal 'mysql'
_(resource.mysqld['key_buffer_size']).must_equal '16M'
end
end
end