rodjek / rspec-puppet

RSpec tests for your Puppet manifests
http://rspec-puppet.com
MIT License
364 stars 203 forks source link

Add support for trusted external data #793

Closed ekinanp closed 3 years ago

ekinanp commented 4 years ago

Signed-off-by: Enis Inan enis.inan@puppet.com

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.04%) to 85.316% when pulling 962329af2daec9f1c30e4483182907924975246c on ekinanp:master into 7f309ce9f310650aaba481772be43b4487f9c51f on rodjek:master.

ekinanp commented 4 years ago

You can do $trusted['external'] to access external trusted data. This PR extends rspec-puppet to support mocking that.

According to the docs, this is an experimental feature. However, the "experimental" part is its implementation and its ability to support multiple external data sources. The basic API of accessing data via $trusted['external'] will remain unchanged.

ekinanp commented 4 years ago

Also, implementation's mostly symmetric with https://github.com/rodjek/rspec-puppet/commit/79149532aa1e89097739aed7b3d8560b3f2ad945#diff-71602a9b90b90213fafc0ce1b38e8664

ekinanp commented 4 years ago

Sounds good. We should change future docs to reference this as trusted_external instead of external_trusted b/c the docs was where I was going off of when naming this stuff.

ekinanp commented 4 years ago

@scotje or @DavidS could this get a review? It's needed to properly unit test any manifest that uses trusted['external'] like e.g. the ServiceNow CMDB integration

garrettrowell commented 3 years ago

Been using the code in this PR and everything seems to work as expected. Would be great to see this in an upcoming release