Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experimental infrastructure for testing custom facts #32

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ekohl
Copy link

@ekohl ekohl commented Oct 31, 2022

This adds testing of custom facts by placing them in spec/facts, similar to how classes have spec/classes and defines have spec/defines. The subject is also set in the same way. It is possible to stub other facts using a facts block and facts are properly cleared before and after a run.

Currently it still has a few TODOs, but the basic functionality works. I'm looking for feedback on the general design (as a user of rspec-puppet, or in other words, a module author) and specific implementation details.

@LukasAud
Copy link

This looks to me. Ideally, we (eventually) should be able to expand further onto this to increase the coverage of our testing on this tool. If you set it as ready for review and CI passes green, I should be able to merge this, @ekohl.


private

# TODO: duplicates adapter
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Rspec::Puppet::Support should be split into a base adapter that also applies to facts and one that includes a catalog. Then you can call setup_puppet properly there. However, that's a larger effort I don't have time for now.

This adds testing of custom facts by placing them in spec/facts, similar
to how classes have spec/classes and defines have spec/defines. The
subject is also set in the same way. It is possible to stub other facts
using a facts block and facts are properly cleared before and after a
run.
@ekohl ekohl marked this pull request as ready for review July 14, 2023 10:45
@ekohl ekohl requested review from a team and bastelfreak as code owners July 14, 2023 10:45
@ekohl ekohl changed the title Add infrastructure for testing custom facts Add experimental infrastructure for testing custom facts Jul 14, 2023
@ekohl
Copy link
Author

ekohl commented Jul 14, 2023

I'd for now label it as experimental, but it's a solid base to build on.

@LukasAud
Copy link

Hey @ekohl, we are looking again at this PR again. The idea sounds good to us but it looks like it still has some TODOs before it can be merged. We are setting this one at a draft for a while so it reflects better the state of the PR. Let us know when this PR is ready.

@LukasAud LukasAud marked this pull request as draft May 23, 2024 15:28
@ekohl
Copy link
Author

ekohl commented May 23, 2024

That's fair. I don't see myself having time in the short term, so if anyone feels like taking this over they should feel welcome to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants