Skip to content

Commit

Permalink
add test for new exec resource
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleygould committed Jan 17, 2025
1 parent 44e8813 commit 0016830
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/java.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}

exec { "validate ${filename} contents":
command => "/usr/bin/openssl x509 -in ${filename} -noout",
command => "openssl x509 -in ${filename} -noout",
cwd => '/tmp',
path => $trusted_ca::path,
logoutput => on_failure,
Expand Down
6 changes: 6 additions & 0 deletions spec/defines/trusted_ca_java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_file('/tmp/mycert-trustedca') }

it do
is_expected.to contain_exec('validate /tmp/mycert-trustedca contents'). \
with_command('openssl x509 -in /tmp/mycert-trustedca -noout').that_notifies('Exec[import /tmp/mycert-trustedca to jks /etc/alternatives/jre_1.7.0/lib/security/cacerts]')

Check failure on line 48 in spec/defines/trusted_ca_java_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end. (https://rubystyle.guide#empty-lines-around-bodies)
end

it do
is_expected.to contain_exec('import /tmp/mycert-trustedca to jks /etc/alternatives/jre_1.7.0/lib/security/cacerts'). \
with_command('keytool -import -noprompt -trustcacerts -alias mycert -file /tmp/mycert-trustedca -keystore /etc/alternatives/jre_1.7.0/lib/security/cacerts -storepass changeit')
Expand Down

0 comments on commit 0016830

Please sign in to comment.