mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
add unit test for limits.conf
This commit is contained in:
parent
797d24c14a
commit
158e4ac1ab
3 changed files with 22 additions and 1 deletions
|
@ -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 = {
|
||||
|
|
5
test/unit/mock/files/limits.conf
Normal file
5
test/unit/mock/files/limits.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
# /etc/security/limits.conf
|
||||
* soft core 0
|
||||
#root hard core 100000
|
||||
* hard rss 10000
|
||||
ftp hard nproc 0
|
15
test/unit/resource_limits_conf_test.rb
Normal file
15
test/unit/resource_limits_conf_test.rb
Normal 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
|
Loading…
Reference in a new issue