puppetlabs_spec_helper
puppetlabs_spec_helper copied to clipboard
(PDK-1047) Add rake task to inspect module for class & defined type definitions
This will eventually allow us to automatically generate skeleton tests for untested classes & defined types.
CLA signed by all contributors.
Codecov Report
Merging #288 into master will increase coverage by
4.28%. The diff coverage is100%.
@@ Coverage Diff @@
## master #288 +/- ##
==========================================
+ Coverage 44.88% 49.17% +4.28%
==========================================
Files 11 13 +2
Lines 782 848 +66
==========================================
+ Hits 351 417 +66
Misses 431 431
| Impacted Files | Coverage Δ | |
|---|---|---|
| lib/puppetlabs_spec_helper/util.rb | 100% <100%> (ø) |
|
| lib/puppetlabs_spec_helper/rake_tasks.rb | 50% <100%> (+2.13%) |
:arrow_up: |
| ...b/puppetlabs_spec_helper/tasks/module_inspector.rb | 100% <100%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 0797846...a7711d2. Read the comment docs.
How much difference would this be to what https://github.com/nwops/puppet-retrospec is doing? Seems like the wheel was reinvented again.
@logicminds Thanks for pointing to that project! (I am not a lawyer), but I'm not sure the licensing of retrospec (GNU AGPL3) is compatible with license of this project (Apache 2)
I wasn't suggesting using retrospec as a library. What I was saying is that retrospec already does the thing being built here. It has been available since 2015 and I don't really know why this code is needed. By building this your just asking for more technical debt and maintenance when your time could be spent elsewhere building other things in PDK.
Test generators suffer from the problem that most people using them have no clue how to write or maintain the tests it creates. Test Education is more important IMHO.
Also I would advise not adding this code here as it bloats what this gem. The test generator will eventually need to be migrated into a separate gem anyways. Look how big retrospec-puppet is! The approach here is what I started with 5 years ago and then abandon it because it wouldn't scale across nodes in the AST.
If the goal is to really create test skeletons just tout the retrospec tool on the puppet blog and help maintain the code to make it better. Making retrospec work with PDK and the pdk templates would be an awesome addition.
P.S. Licenses can always be changed.
Apologies @logicminds. I interpreted what you said the wrong way.
Also I would advise not adding this code here as it bloats what this gem.
I would have to agree with this. It does seem like PDK would be the better place for this functionality. @rodjek @scotje Thoughts?
What I was saying is that retrospec already does the thing being built here.
The goal of PDK-1047 is not to implement retrospec style functionality. We do not want to inspect the contents of the class or defined types to generate extensive tests for all the contained resources.
Test generators suffer from the problem that most people using them have no clue how to write or maintain the tests it creates. Test Education is more important IMHO.
The scope of this is simply to be able to examine a module during pdk convert and feed this information into the existing PDK object generators so that the very minimal template specs are generated, the same specs that are generated by running pdk new class or pdk new defined_type.
These generated tests are little more than it { is_expected.to compile }, which we've found is enough for most users.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
👋 This has been open since 2019 and has had no further activity since.
I'm going to close this for house keeping, however the internal ticket will stick around for future reference.