From 4c96ff30360ca49b093284ad33c360e84cba5cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 11 Dec 2023 14:37:23 -1000 Subject: [PATCH] Add more checks for onlyif / unless These commands are supposed to be supported, but they are not tested, so add tests to demonstrate that they work as intended. --- .../puppet-lint/plugins/check_unsafe_interpolations_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/puppet-lint/plugins/check_unsafe_interpolations_spec.rb b/spec/puppet-lint/plugins/check_unsafe_interpolations_spec.rb index 22b99f4..0cd088a 100644 --- a/spec/puppet-lint/plugins/check_unsafe_interpolations_spec.rb +++ b/spec/puppet-lint/plugins/check_unsafe_interpolations_spec.rb @@ -33,6 +33,8 @@ class foo { exec { 'bar': command => "echo ${foo} ${bar}", + onlyif => "${baz}", + unless => "${bazz}", } } @@ -40,12 +42,14 @@ class foo { 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