add unit test for limits.conf

This commit is contained in:
Christoph Hartmann 2015-09-05 20:29:34 +02:00 committed by Dominik Richter
parent 797d24c14a
commit 158e4ac1ab
3 changed files with 22 additions and 1 deletions

View file

@ -14,7 +14,8 @@ def loadResource (resource, *args)
'/etc/ssh/sshd_config' => IO::File.join(scriptpath, '/unit/mock/files/sshd_config'),
'/etc/passwd' => IO::File.join(scriptpath, '/unit/mock/files/passwd'),
'/etc/ntp.conf' => IO::File.join(scriptpath, '/unit/mock/files/ntp.conf'),
'/etc/login.defs' => IO::File.join(scriptpath, '/unit/mock/files/login.defs')
'/etc/login.defs' => IO::File.join(scriptpath, '/unit/mock/files/login.defs'),
'/etc/security/limits.conf' => IO::File.join(scriptpath, '/unit/mock/files/limits.conf')
}
@cmd_mapping = {

View file

@ -0,0 +1,5 @@
# /etc/security/limits.conf
* soft core 0
#root hard core 100000
* hard rss 10000
ftp hard nproc 0

View file

@ -0,0 +1,15 @@
# encoding: utf-8
require 'helper'
require 'vulcano/resource'
describe 'Vulcano::Resources::LimitsConf' do
describe 'limits_conf' do
let(:resource) { loadResource('limits_conf') }
it 'verify limits.conf config parsing' do
_(resource.send('*')).must_equal [['soft', 'core', '0'], ['hard', 'rss', '10000']]
_(resource.send('ftp')).must_equal [["hard", "nproc", "0"]]
end
end
end