2015-09-05 15:40:02 +00:00
|
|
|
# encoding: utf-8
|
2015-10-06 16:55:44 +00:00
|
|
|
# author: Christoph Hartmann
|
|
|
|
# author: Dominik Richter
|
2015-09-05 15:40:02 +00:00
|
|
|
|
|
|
|
require 'helper'
|
2015-10-26 03:04:18 +00:00
|
|
|
require 'inspec/resource'
|
2015-09-05 15:40:02 +00:00
|
|
|
|
2015-10-26 03:04:18 +00:00
|
|
|
describe 'Inspec::Resources::Processes' do
|
2015-10-26 15:47:54 +00:00
|
|
|
it 'handles empty process results' do
|
|
|
|
resource = load_resource('processes', 'nothing')
|
|
|
|
_(resource.list).must_equal []
|
|
|
|
end
|
|
|
|
|
2015-09-22 16:33:05 +00:00
|
|
|
it 'verify processes resource' do
|
2015-10-12 11:21:50 +00:00
|
|
|
resource = load_resource('processes', '/bin/bash')
|
2015-09-22 16:33:05 +00:00
|
|
|
_(resource.list).must_equal [{
|
|
|
|
user: 'root',
|
|
|
|
pid: '1',
|
|
|
|
cpu: '0.0',
|
|
|
|
mem: '0.0',
|
|
|
|
vsz: '18084',
|
|
|
|
rss: '3228',
|
|
|
|
tty: '?',
|
|
|
|
stat: 'Ss',
|
|
|
|
start: '14:15',
|
|
|
|
time: '0:00',
|
2015-10-12 11:21:50 +00:00
|
|
|
command: '/bin/bash',
|
2015-09-22 16:33:05 +00:00
|
|
|
}]
|
2015-09-05 15:40:02 +00:00
|
|
|
|
2015-09-22 16:33:05 +00:00
|
|
|
_(resource.list.length).must_equal 1
|
2015-09-05 15:40:02 +00:00
|
|
|
end
|
|
|
|
end
|