Skip to content

Commit ba7ba72

Browse files
authored
Merge pull request #8628 from joshcooper/add_lookup_options_7293
(PUP-7315) Add test for interpolation of lookup options
2 parents d6ca71d + c642d6c commit ba7ba72

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

spec/unit/functions/lookup_spec.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,6 +3303,29 @@ def ruby_dig(segments, options, context)
33033303
end
33043304
end
33053305

3306+
context 'using options containing intepolated paths to the key pair' do
3307+
let(:scope_additions) { { 'priv_path' => private_key_path, 'pub_path' => public_key_path } }
3308+
3309+
let(:hiera_yaml) do
3310+
<<-YAML.unindent
3311+
version: 5
3312+
defaults:
3313+
datadir: #{code_dir}/hieradata
3314+
hierarchy:
3315+
- name: "secret data"
3316+
lookup_key: eyaml_lookup_key
3317+
path: common.eyaml
3318+
options:
3319+
pkcs7_private_key: "%{priv_path}"
3320+
pkcs7_public_key: "%{pub_path}"
3321+
YAML
3322+
end
3323+
3324+
it 'finds data in the global layer' do
3325+
expect(lookup('a')).to eql("Encrypted value 'a' (from global)")
3326+
end
3327+
end
3328+
33063329
context 'with special extension declared in options' do
33073330
let(:environment_files) { {} }
33083331
let(:hiera_yaml) do

0 commit comments

Comments
 (0)