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

task to check if puppet resources have a spec described #439

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

Conversation

h0tw1r3
Copy link

@h0tw1r3 h0tw1r3 commented Feb 15, 2024

Anyone interested in this?
Request for comment / improvements / toss it out?

Example:

$ pdk bundle exec rake spec_described[90]
pdk (INFO): Using Ruby 3.2.2
pdk (INFO): Using Puppet 8.4.0
===> rake: spec_described
Spec described coverage: 92.9%
  * 4 defines: 100.0%
  * 21 classes: 95.2%
    missing:
    - puppetdb::something
    unknown:
    - something in spec/classes/whoknows_spec.rb
  * 1 type_alias: 0.0%
    missing:
    - Puppetdb::Ttl
  * 2 functions: 100.0%

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

Comparison is base (e3b7546) 41.71% compared to head (d49de85) 40.85%.

Files Patch % Lines
lib/puppetlabs_spec_helper/rake_tasks.rb 16.66% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #439      +/-   ##
==========================================
- Coverage   41.71%   40.85%   -0.86%     
==========================================
  Files          10       10              
  Lines         676      700      +24     
==========================================
+ Hits          282      286       +4     
- Misses        394      414      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I like the idea, but I don't want to test my private classes (like $module::params). Sadly you can only declare a class as private using puppet-strings so that may be hard with your existing code.

Overall puppet-strings can already parse and extract the various types, which is probably better than using regular expressions. Any thoughts on using puppet-strings to generate a list of all resources?

@h0tw1r3
Copy link
Author

h0tw1r3 commented Feb 16, 2024

Overall puppet-strings can already parse and extract the various types, which is probably better than using regular expressions. Any thoughts on using puppet-strings to generate a list of all resources?

Thanks for the feedback. I'll check it out, cheers!

@gavindidrichsen
Copy link
Contributor

Hi @h0tw1r3. We all like this on devx, so kicked off a discussion #442

@bastelfreak
Copy link
Collaborator

I like this and share the same opinion as @ekohl . I think this would be a helpful addition to puppetlabs_spec_helper.

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

Successfully merging this pull request may close these issues.

4 participants