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

Drivelist tests #962

Merged
merged 6 commits into from
Feb 7, 2025
Merged

Drivelist tests #962

merged 6 commits into from
Feb 7, 2025

Conversation

lbrooks
Copy link
Contributor

@lbrooks lbrooks commented Dec 3, 2024

Issue: devicelist.list() could return an incorrect mountpoint path if on the first call the appropriate descriptor was found without any mountpoints and the devicelist.list() function returned values in a different order.

Changes:

  • Root Fix: Replaced the nested while loop with fail fast continue statements
  • Changed the ordering of the mountpoint check to prevent a failure when accessing a value in an array when the array is undefined
  • Switched from two string contains to a single RegExp test
  • Fixed the declared types
  • Added full test coverage

Possible Issue Uncovered:

  • Method will loop infinitely until a device with the appropriate descriptor and a valid mountpoint is found.

I have added logic to support enforcing a maximum number of retries and tests to ensure the max is respected but this PR does not put a maximum retry count on the method.

If the devicelist function returned objects in a different order
the existing function could return an incorrect mountpoint path.

Fixed this by refactoring the method.

Additionally, it looks like this method will loop forever until
a valid device and mountpoint is found. Unsure if limiting this
to a maximum retry count would break things, so leaving as
unlimited retries.

Signed-off-by: Lawrence Brooks <[email protected]>
@lbrooks lbrooks marked this pull request as ready for review December 3, 2024 04:52
@alexpargon alexpargon merged commit e1a9003 into Dygmalab:development Feb 7, 2025
3 checks passed
@lbrooks lbrooks deleted the drivelist-tests branch February 7, 2025 18:49
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