Skip to content

Commit

Permalink
Add more checks for onlyif / unless
Browse files Browse the repository at this point in the history
These commands are supposed to be supported, but they are not tested, so
add tests to demonstrate that they work as intended.
  • Loading branch information
smortex committed Dec 12, 2023
1 parent 3514c93 commit 4c96ff3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/puppet-lint/plugins/check_unsafe_interpolations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,23 @@ class foo {
exec { 'bar':
command => "echo ${foo} ${bar}",
onlyif => "${baz}",
unless => "${bazz}",
}
}
PUPPET
end

it 'detects multiple unsafe exec command arguments' do
expect(problems).to have(2).problems
expect(problems).to have(4).problems
end

it 'creates two warnings' do
expect(problems).to contain_warning(msg)
expect(problems).to contain_warning("unsafe interpolation of variable 'bar' in exec command")
expect(problems).to contain_warning("unsafe interpolation of variable 'baz' in exec command")
expect(problems).to contain_warning("unsafe interpolation of variable 'bazz' in exec command")
end
end

Expand Down

0 comments on commit 4c96ff3

Please sign in to comment.