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

(maint) Add a spec case for the provision::abs task #186

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

jpartlow
Copy link
Contributor

The abs.rb is refactored into a class that is executed only if the task
file is the executing program. This allows the spec to load the task and
manipulate the class while mocking externals. The webmock gem is used to
provide HTTP::Net mocking.

The spec is not exhaustive, but hopefully covers enough to validate that
the refactor didn't break the task, and that the bug I added in #182 is
patched.

It could be expanded, and could serve as a template for adding specs
for other tasks in the module.

It does look to expose an edge case bug of calling the provision task
with an inventory directory specified that contains a pre-existing
inventory file.

@jpartlow
Copy link
Contributor Author

jpartlow commented Dec 15, 2021

I have some rubocop issues to sort out. Ok, those are fixed.

spec/tasks/abs_spec.rb Outdated Show resolved Hide resolved
spec/tasks/abs_spec.rb Outdated Show resolved Hide resolved
spec/tasks/abs_spec.rb Outdated Show resolved Hide resolved
tasks/abs.rb Outdated Show resolved Hide resolved
MikaelSmith
MikaelSmith previously approved these changes Dec 16, 2021
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@183fefe). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 75e0e7f differs from pull request most recent head 24f910e. Consider uploading reports for the commit 24f910e to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main     #186   +/-   ##
=======================================
  Coverage        ?   76.97%           
=======================================
  Files           ?        2           
  Lines           ?      139           
  Branches        ?        0           
=======================================
  Hits            ?      107           
  Misses          ?       32           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 183fefe...24f910e. Read the comment docs.

MikaelSmith
MikaelSmith previously approved these changes Jan 26, 2022
chelnak
chelnak previously approved these changes Feb 11, 2022
The abs.rb is refactored into a class that is executed only if the task
file is the executing program. This allows the spec to load the task and
manipulate the class while mocking externals. The webmock gem is used to
provide HTTP::Net mocking.

The spec is not exhaustive, but hopefully covers enough to validate that
the refactor didn't break the task, and that the bug I added in puppetlabs#182 is
patched.

It could be expanded, and could serve as a template for adding specs
for other tasks in the module.

It does look to expose an edge case bug of calling the provision task
with an inventory directory specified that contains a pre-existing
inventory file.
@jpartlow jpartlow merged commit 21a9e78 into puppetlabs:main Feb 11, 2022
@jpartlow jpartlow deleted the maint-add-abs-task-spec branch February 11, 2022 19:21
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.

5 participants