[controller] Fix block device filtering and add relevant tests #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses an issue with our controller's filtering of block devices. Previously, in certain scenarios, the controller failed to remove block devices that have partitions. This update provides a fix to ensure accurate filtering and handling of block devices with partitions. Additionally, tests have been added with sample
lsblk
output to ensure that the filtering logic remains robust and future changes do not break this functionality.Why do we need it, and what problem does it solve?
This fix addresses an issue where the controller incorrectly leaves block devices with partitions, which could lead to improper resource management or potential conflicts within the system. The added tests serve to safeguard the integrity of this fix, ensuring that any future modifications maintain the correct behavior.
What is the expected result?
After applying these changes, the controller will accurately filter and handle block devices, especially those with partitions. The added tests, which simulate scenarios using
lsblk
output, will verify the robustness of the filtering logic. To confirm these changes, one should observe that the controller no longer retains block devices with partitions that should be filtered out and that the tests pass successfully, indicating the correctness of the implemented logic.Checklist