dsccommunity / StorageDsc

DSC resource module is used to manage storage on Windows Servers.
https://dsccommunity.org
MIT License
71 stars 52 forks source link

Add support for DiskIdType Guid in xDisk, xDiskAccessPath and xWaitForDisk - Fixes #104 #107

Closed PlagueHO closed 7 years ago

PlagueHO commented 7 years ago

This PR adds support for specifying the disk to work with using the Disk GUID. This is a unique value that is only assigned to the disk once it is initialized (a partition table is created). It will work with either MBR or GPT partition formats.

I've applied auto-formatting on any files I touched.

Tagging @Zuldan


This change is Reviewable

codecov-io commented 7 years ago

Codecov Report

Merging #107 into dev will decrease coverage by <1%. The diff coverage is 100%.

Impacted file tree graph

@@        Coverage Diff         @@
##           dev   #107   +/-   ##
==================================
- Coverage   95%    94%   -1%     
==================================
  Files        5      5           
  Lines      687    671   -16     
==================================
- Hits       657    636   -21     
- Misses      30     35    +5
johlju commented 7 years ago

Reviewed 15 of 19 files at r1, 6 of 6 files at r2. Review status: all files reviewed at latest revision, 9 unresolved discussions.


.markdownlint.json, line 4 at r2 (raw file):

    "default": true,
    "MD029": {
        "style": "ordered"

Should be "one" now.


CHANGELOG.md, line 15 at r2 (raw file):

- Added .markdownlint.json file to configure markdown rules to validate.
- Clean up Badge area in README.MD - See [Issue 110](https://github.com/PowerShell/xStorage/issues/110)
- Disabled MD013 rule checking to enable badge table.

Wouldn't it be better to use headers instead to have this enable? See example in xFailoverCluster and xSQLServer.

Ps. I don't like that there is no way to split a table row on several rows. :disappointed: Ds.


Tests/Integration/MSFT_xWaitForDisk.Integration.Tests.ps1, line 135 at r2 (raw file):

                        -ConfigurationData $configData
                    Start-DscConfiguration -Path $TestDrive -ComputerName localhost -Wait -Verbose -Force
                } | Should not throw

Should Not Throw (upper S, N and T). All other tests too.


Tests/TestHelpers/CommonTestHelper.psm1, line 125 at r2 (raw file):

        # The disk will be initialized with GPT
        $diskPartScript += @"

Remove blank row here? If it is needed for the script to work, than make a comment that it is needed.


Tests/Unit/MSFT_xDisk.Tests.ps1, line 1929 at r2 (raw file):

                $script:result = $null

                It 'calling test Should Not Throw' {

It 'Should not throw an error' seems better.


Tests/Unit/MSFT_xDiskAccessPath.Tests.ps1, line 1429 at r2 (raw file):

                $script:result = $null

                It 'calling test Should Not Throw' {

Same as previous comment.


Tests/Unit/MSFT_xWaitForDisk.Tests.ps1, line 121 at r2 (raw file):

                $script:result = $null

                It 'Should Not Throw' {

Same as previous comment.


Tests/Unit/MSFT_xWaitForDisk.Tests.ps1, line 198 at r2 (raw file):

                    -Verifiable

                It 'Should Not Throw' {

Same as previous comment. There are a lot of these (maybe even more of these in unchanged code?


Tests/Unit/StorageDsc.Common.Tests.ps1, line 184 at r2 (raw file):

                }

                It 'Should call exepced mocks' {

Typo (and all others below too)


Comments from Reviewable

PlagueHO commented 7 years ago

Sorry about all the changes here - it is all working towards HQRM on this module as well.


Review status: 12 of 26 files reviewed at latest revision, 10 unresolved discussions.


.markdownlint.json, line 4 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
Should be "one" now.

Done.


CHANGELOG.md, line 15 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
Wouldn't it be better to use headers instead to have this enable? See example in xFailoverCluster and xSQLServer. Ps. I don't like that there is no way to split a table row on several rows. :disappointed: Ds.

Agreed and done!


Tests/Integration/MSFT_xWaitForDisk.Integration.Tests.ps1, line 135 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
`Should Not Throw` (upper S, N and T). All other tests too.

Did a global search/replace and fixed 114 of these (sorry!).


Tests/TestHelpers/CommonTestHelper.psm1, line 125 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
Remove blank row here? If it is needed for the script to work, than make a comment that it is needed.

Doh - no that shouldn't be there. Fixed.


Tests/Unit/MSFT_xDisk.Tests.ps1, line 1929 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
`It 'Should not throw an error'` seems better.

Changed to match all the others.


Tests/Unit/MSFT_xDiskAccessPath.Tests.ps1, line 1429 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
Same as previous comment.

Done. I also decided to standardize all the other it messages to start with 'Should'.


Tests/Unit/MSFT_xWaitForDisk.Tests.ps1, line 121 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
Same as previous comment.

Done.


Tests/Unit/MSFT_xWaitForDisk.Tests.ps1, line 198 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
Same as previous comment. There are a lot of these (maybe even more of these in unchanged code?

I've gone through all tests and changed them all to use the same message:

It 'Should not throw an exception'

Sorry about the large number of changed files now!


Tests/Unit/StorageDsc.Common.Tests.ps1, line 184 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
Typo (and all others below too)

Good catch! Global search replace fixed them all.


Comments from Reviewable

PlagueHO commented 7 years ago

Thanks for the review @Johlju - should be good to go now!


Review status: 12 of 26 files reviewed at latest revision, 9 unresolved discussions.


Comments from Reviewable

johlju commented 7 years ago
:lgtm:

Last comment is non-blocker.

No worries about making large number of changes. For certain style comments I knew that it will result in a global search/replace by you :wink: I happy you do that so we rid of all all that technical debt. :smile:


Reviewed 14 of 14 files at r3. Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


Tests/Unit/MSFT_xDiskAccessPath.Tests.ps1, line 1639 at r1 (raw file):

                }

                # skipped due to:  https://github.com/PowerShell/xStorage/issues/22

This issue is closed, should this be skipped still?


Comments from Reviewable

johlju commented 7 years ago

Something happened to the test in AppVeyor. Maybe kick them off again?

PlagueHO commented 7 years ago

I thought closing and reopening the PR was supposed to kick the AppVeyor job. Appears not. I'll need to submit a dummy commit :cry:

@johlju - should be good to go. Can you sign off the last file? Thanks sir!

johlju commented 7 years ago

Strange, opening and closing has worked every time so far for me. :)

johlju commented 7 years ago
:lgtm:

Reviewed 1 of 1 files at r4. Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

johlju commented 7 years ago
:lgtm:

Just a test how Reviewable behaves after all files has been reviewed and one comment LGTM.


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

johlju commented 7 years ago

Ah. It seems that I should not write LGTM after reviewing the last, file, but after published the last approved file (marking it green). After I published that, then I should type :LGTM: and publish that separate, it then writes out; all files reviewed at latest revision, all discussions resolved, all commit checks successful.. You learn every day. :smile:

PlagueHO commented 7 years ago

Thanks @johlju - again, as always, I appreciate your work on this! :grin: