mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
Added test to catch the control execution issue while using controls option
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
This commit is contained in:
parent
2f41c16ad4
commit
6853f6450e
2 changed files with 28 additions and 0 deletions
19
test/fixtures/profiles/filter_table/controls/only_evaluate_included_controls.rb
vendored
Normal file
19
test/fixtures/profiles/filter_table/controls/only_evaluate_included_controls.rb
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
control "foo" do
|
||||
describe 'a thing' do
|
||||
it { should cmp 'a thing' }
|
||||
end
|
||||
end
|
||||
|
||||
control "bar" do
|
||||
puts 'Control block executed'
|
||||
describe 'a thing' do
|
||||
it { should cmp 'a thing' }
|
||||
end
|
||||
end
|
||||
|
||||
control "baz" do
|
||||
puts 'Control block executed'
|
||||
describe 'a thing' do
|
||||
it { should cmp 'a thing' }
|
||||
end
|
||||
end
|
|
@ -178,6 +178,15 @@ Test Summary: 0 successful, 0 failures, 0 skipped
|
|||
assert_exit_code 100, out
|
||||
end
|
||||
|
||||
it "executes only specified controls when selecting the controls by literal names" do
|
||||
inspec("exec " + File.join(profile_path, "filter_table") + " --no-create-lockfile --controls foo")
|
||||
|
||||
_(stdout).must_include "\nProfile Summary: 1 successful controls, 0 control failures, 0 controls skipped\n"
|
||||
_(stderr).must_equal ""
|
||||
|
||||
assert_exit_code 0, out
|
||||
end
|
||||
|
||||
it "executes only specified controls when selecting passing controls by literal names" do
|
||||
inspec("exec " + File.join(profile_path, "filter_table") + " --no-create-lockfile --controls 2943_pass_undeclared_field_in_hash 2943_pass_irregular_row_key")
|
||||
|
||||
|
|
Loading…
Reference in a new issue