mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Updated test so that can run in the test enviornment
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
This commit is contained in:
parent
7c25a2b5df
commit
a0d669a0f0
2 changed files with 3 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
control 'exception_catcher_test' do
|
||||
describe shadow.users('root') do
|
||||
describe shadow('/tmp/no-file').users('root') do
|
||||
its(:passwords) { should_not include('*') }
|
||||
end
|
||||
end
|
|
@ -10,11 +10,6 @@ describe "filtertable functional tests" do
|
|||
run_inspec_process(cmd, run_opts)
|
||||
end
|
||||
|
||||
def run_result_for_controls_without_sudo(controls)
|
||||
cmd = "exec " + ft_profile_path + " --controls " + controls.join(" ") + " --no-sudo"
|
||||
run_inspec_process(cmd, run_opts)
|
||||
end
|
||||
|
||||
def failed_control_test_outcomes(run_result)
|
||||
failed_controls = @json["profiles"][0]["controls"].select { |ctl| ctl["results"][0]["status"] == "failed" }
|
||||
|
||||
|
@ -144,9 +139,9 @@ describe "filtertable functional tests" do
|
|||
describe "if control fails" do
|
||||
it "should show the exact error message" do
|
||||
controls = ["exception_catcher_test"]
|
||||
run_result = run_result_for_controls_without_sudo(controls)
|
||||
run_result = run_result_for_controls(controls)
|
||||
outcome_hash = skipped_control_test_outcomes(run_result)
|
||||
_(outcome_hash["exception_catcher_test"]).must_include "Can't read file: \/etc\/shadow"
|
||||
_(outcome_hash["exception_catcher_test"]).must_include "Can't find file: \/tmp\/no-file"
|
||||
assert_exit_code 101, run_result
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue