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

(CAT-1991) - Skip missing dirs invalid_dir method #334

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

jordanbreen28
Copy link
Contributor

@jordanbreen28 jordanbreen28 commented Aug 20, 2024

Summary

Updates invalid_directories? method in Pwsh::Util to ignore non existent entries for the lib env.
Also warn rather than raise when invalid directory is found, this is not a critical error and is overprotective (see internal jira).

Refactored invalid_directories? method, new code removes unnecessary lines and opts for the direct return value of filtered array using a conditional .any? that meets the new requirements of the method.

More unit testing added to cover the new functioanlity.

Additional Context

Add any additional context about the problem here.

  • Root cause and the steps to reproduce. (If applicable)
  • Thought process behind the implementation.

Related Issues (if any)

Mention any related issues or pull requests.

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified.

@jordanbreen28 jordanbreen28 force-pushed the cat-1991-skip_missing_dir_check branch 2 times, most recently from cbf9c07 to bad8a2e Compare August 20, 2024 13:37
Copy link

codecov bot commented Aug 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.08%. Comparing base (a6dd0f0) to head (729b60d).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #334      +/-   ##
==========================================
- Coverage   92.10%   92.08%   -0.03%     
==========================================
  Files           6        6              
  Lines         722      720       -2     
==========================================
- Hits          665      663       -2     
  Misses         57       57              

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

Prior to this commit, the invalid_directories? method in pwsh::util
would return true if a directory did not exist. We found this to cause
issues with updating packages which modifiy the LIB env, as missing
entries during install/uninstall/upgrade would raise an error and exit.

Now, we alter the check to skip entries that do not exist, and only
flag for an invalid directory if the path supplied is not a directory.
This commit updates the initialize method in Pwsh::Manager to only warn
not raise on invalid_directory returning true.
@jordanbreen28 jordanbreen28 force-pushed the cat-1991-skip_missing_dir_check branch from bad8a2e to 729b60d Compare August 20, 2024 13:46
@jordanbreen28 jordanbreen28 marked this pull request as ready for review August 20, 2024 13:53
@jordanbreen28 jordanbreen28 requested a review from a team as a code owner August 20, 2024 13:53
@david22swan david22swan merged commit 5603c13 into main Aug 20, 2024
7 of 8 checks passed
@david22swan david22swan deleted the cat-1991-skip_missing_dir_check branch August 20, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants