-
Notifications
You must be signed in to change notification settings - Fork 52
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
Disk-AccessPath: fixing get-partition to pull current state of object #198
Disk-AccessPath: fixing get-partition to pull current state of object #198
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #198 +/- ##
===================================
+ Coverage 94% 94% +<1%
===================================
Files 8 8
Lines 889 890 +1
===================================
+ Hits 837 838 +1
Misses 52 52 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @JoshuaJSwain)
a discussion (no related file):
Please look at the failing tests here:
https://ci.appveyor.com/project/PowerShell/storagedsc/builds/22819645?fullLog=true#L2514
DSCResources/MSFT_DiskAccessPath/MSFT_DiskAccessPath.psm1, line 522 at r1 (raw file):
$assignedPartition
This is already assigned on line 285 to the same as before this change. What is the difference with the line 285 and this line, with this change?
Now it only returns the specific partition number if the access path is the same as the user provided. Line 285 will return the first partition with the access path the same as the user provided?
This might just be me not understanding what you trying to achieve with this change, could you please explain? 😃
DSCResources/MSFT_DiskAccessPath/MSFT_DiskAccessPath.psm1, line 532 at r1 (raw file):
# Setting the partition property NoDefaultDriveLetter to True to prevent adding drive letter on reboot
I think this should say that we set the NoDefaultDriveLetter to the value provided by the user, or $true if the user did not provide a value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @johlju and @JoshuaJSwain)
CHANGELOG.md, line 11 at r1 (raw file):
- Clean up module manifest to correct Author and Company - fixes [Issue #191](https://github.com/PowerShell/StorageDsc/issues/191). - Fix a bug where current state of NoDefaultDriveLetter state
This reads a bit odd - could it be:
Fix a bug where the current state of NoDefaultDriveLetter is not handled. Added a refresh of the current partition information prior to checking state - fixes [...]
DSCResources/MSFT_DiskAccessPath/MSFT_DiskAccessPath.psm1, line 522 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$assignedPartition
This is already assigned on line 285 to the same as before this change. What is the difference with the line 285 and this line, with this change?
Now it only returns the specific partition number if the access path is the same as the user provided. Line 285 will return the first partition with the access path the same as the user provided?This might just be me not understanding what you trying to achieve with this change, could you please explain? 😃
I suspect you might be doing this because we may have changed (or created) the partition within one of the prior if blocks. However, this code doesn't really make sense anyway - That is going to get All Partitions on ALL disks that match the partition number.
It appears all you're trying to do is get the current state of the partition we're working on into the $assignedPartition variable. You'd just need this:
$assignedPartition = $partition | Get-Partition
DSCResources/MSFT_DiskAccessPath/MSFT_DiskAccessPath.psm1, line 525 at r1 (raw file):
Where-Object -Property AccessPaths -Contains -Value $AccessPath if ($assignedPartition.NoDefaultDriveLetter -ne $NoDefaultDriveLetter)
Also this is not indented at the right level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 5 unresolved discussions (waiting on @johlju, @JoshuaJSwain, and @PlagueHO)
a discussion (no related file):
Previously, johlju (Johan Ljunggren) wrote…
Please look at the failing tests here:
https://ci.appveyor.com/project/PowerShell/storagedsc/builds/22819645?fullLog=true#L2514
Done.
DSCResources/MSFT_DiskAccessPath/MSFT_DiskAccessPath.psm1, line 522 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
I suspect you might be doing this because we may have changed (or created) the partition within one of the prior if blocks. However, this code doesn't really make sense anyway - That is going to get All Partitions on ALL disks that match the partition number.
It appears all you're trying to do is get the current state of the partition we're working on into the $assignedPartition variable. You'd just need this:
$assignedPartition = $partition | Get-Partition
Correct, I just need to pull in the current state, changes updated.
DSCResources/MSFT_DiskAccessPath/MSFT_DiskAccessPath.psm1, line 525 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Also this is not indented at the right level.
Done.
Updated with the patch. I want to run this through some integration tests before calling it good. |
I've tested this in a live environment and confirmed this fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PlagueHO I have resolved my comments. I leave it to you to approve the last changes.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @johlju, @JoshuaJSwain, and @PlagueHO)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed the unit tests for the resource are not actually that good.
All the Assert-MockCalled
functions are missing the -Exactly
parameter. This means the tests aren't as effective as they could be.
@JoshuaJSwain - I'm going to quickly try and get a PR through to correct the unit tests for this resource so we can be sure we're performing the expected calls. Once my PR is through you'll need to rebase this one - it'll likely cause the unit tests to fail: this is what alerted me to the problem - I'd expect your change to break the unit tests.
Reviewed 2 of 2 files at r2.
Reviewable status: complete! all files reviewed, all discussions resolved
@JoshuaJSwain - when this one #201 goes through then you can rebase and see if your tests still pass (I'd expect some to fail). |
Ok @JoshuaJSwain - #201 has gone through. Can you rebase and see if your tests pass and correct if necessary? |
Hi @JoshuaJSwain - this is what I expected- the tests to fail as they weren't actually very good. Now they are better tests you will need to correct them to validate your code correctly. |
I take a look at this one week of 4/8. Should be straight forward to fix
them up. Thanks!
Josh Swain
…On Thu, Mar 28, 2019, 5:25 AM Daniel Scott-Raynsford < ***@***.***> wrote:
Hi @JoshuaJSwain <https://github.com/JoshuaJSwain> - this is what I
expected- the tests to fail as they weren't actually very good. Now they
are better tests you will need to correct them to validate your code
correctly.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#198 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AdawlETt0V1NeKeptgjAxeYQIHwPuTKMks5vbHpBgaJpZM4bdbOw>
.
|
98124c8
to
e409232
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Awesome stuff and sorry about the delay.
I just realized- there isn't an entry in the CHANGELOG.MD for this - can you add something under the # Unreleased section? Then we're good to go. Sorry for not picking up earlier.
Reviewed 1 of 2 files at r3.
Reviewable status: complete! all files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, updated the changelog. thanks!
Reviewable status: 2 of 3 files reviewed, all discussions resolved (waiting on @PlagueHO)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r4.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @JoshuaJSwain)
CHANGELOG.md, line 6 at r4 (raw file):
- DiskAccessPath: - Added a get-partion to properly handle setting the NoDefaultDriveLetter
I think 'partition' is spelled wrong. Also, can you use Get-Partition
(e.g. capitization)
CHANGELOG.md, line 7 at r4 (raw file):
- DiskAccessPath: - Added a get-partion to properly handle setting the NoDefaultDriveLetter parameter - fixes [Issue #198](https://github.com/PowerShell/StorageDsc/pull/198)
Nitpick: Can you add a full stop on the end here after the ')'. Sorry for being a pain 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @PlagueHO)
CHANGELOG.md, line 6 at r4 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
I think 'partition' is spelled wrong. Also, can you use
Get-Partition
(e.g. capitization)
Done.
CHANGELOG.md, line 7 at r4 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Nitpick: Can you add a full stop on the end here after the ')'. Sorry for being a pain 😁
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r5.
Reviewable status: complete! all files reviewed, all discussions resolved
Pull Request (PR) description
This Pull Request (PR) fixes the following issues
Task list
Entry should say what was changed, and how that affects users (if applicable).
and comment-based help.
This change is