为什么此测试返回失败?我正在使用 serverspec 2。
1) Service "cfengine3" should be enabled
Failure/Error: it { should be_enabled }
expected Service "cfengine3" to be enabled
sudo -p 'Password: ' /bin/sh -c chkconfig\ --list\ cfengine3\ \|\ grep\ 3:on
从规范文件:
describe service( 'cfengine3' ) do
it { should be_enabled }
end
主机手动测试:
newatson@atlspf01:~$ sudo /bin/sh -c chkconfig\ --list\ cfengine3\ \|\ grep\ 3:on
cfengine3 0:off 1:off 2:on 3:on 4:on 5:on 6:off
newatson@atlspf01:~$ echo $?
0