add testcase for #1332

Signed-off-by: Wei, He <weihe924stephen@gmail.com>
This commit is contained in:
Wei, He 2016-11-30 09:20:49 +09:00
parent 861856fbd9
commit fd04daf77c
2 changed files with 23 additions and 0 deletions

View file

@ -2,3 +2,7 @@ LABEL PID %CPU %MEM VSZ RSS TT STAT STAR
system_u:system_r:init_t:s0 5127 0.0 0.2 547208 5376 ? Ss 10:54:22 00:00:00 opscode-pgsql postgres: bifrost bifrost 127.0.0.1(43699) idle
system_u:system_r:init_t:s0 5140 1.9 11.2 2908400 215308 ? Ssl 10:54:23 00:00:05 opscode java -Xmx466M -Xms466M -XX:NewSize=32M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Xloggc:/var/log/opscode/opscode-solr4/gclog.log -verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintTenuringDistribution -Dsolr.data.dir=/var/opt/opscode/opscode-solr4/data -Dsolr.solr.home=/var/opt/opscode/opscode-solr4/home -Djava.io.tmpdir=/var/opt/opscode/opscode-solr4/ -server -jar /opt/opscode/embedded/service/opscode-solr4/jetty/start.jar
system_u:system_r:init_t:s0 5169 0.0 0.0 4084 536 ? S 10:54:23 00:00:00 opscode svlogd -tt /var/log/opscode/opscode-solr4
- 4589 0.0 0.0 70992 2864 ? Ss Nov 09 00:01:01 root /usr/local/apache2/bin/httpd -k start
- 11662 0.0 0.0 70992 1460 ? S Nov 28 00:00:13 httpd /usr/local/apache2/bin/httpd -k start
- 11663 0.0 0.1 874196 4792 ? Sl Nov 28 00:00:12 httpd /usr/local/apache2/bin/httpd -k start
- 11664 0.0 0.1 874156 4468 ? Sl Nov 28 00:00:11 httpd /usr/local/apache2/bin/httpd -k start

View file

@ -49,6 +49,25 @@ describe 'Inspec::Resources::Processes' do
})
end
it 'verify long-run processes resource on linux os' do
resource = MockLoader.new(:centos6).load_resource('processes', 'httpd')
_(resource.list.length).must_equal 4
_(resource.list[0].to_h).must_equal({
label: '-',
pid: 4589,
cpu: '0.0',
mem: '0.0',
vsz: 70992,
rss: 2864,
tty: '?',
stat: 'Ss',
start: 'Nov 09',
time: '00:01:01',
user: 'root',
command: '/usr/local/apache2/bin/httpd -k start',
})
end
it 'access attributes of a process' do
resource = MockLoader.new(:centos6).load_resource('processes', 'postgres: bifrost bifrost')
process = resource.list[0]