-
Notifications
You must be signed in to change notification settings - Fork 134
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
xArchive: Update to a high quality resource and add tests #319
Conversation
4edd59d
to
6082964
Compare
Reviewed 2 of 25 files at r1. README.md, line 15 at r1 (raw file):
'If you would' DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 21 at r1 (raw file):
Why not just add this type above the if/else since they both need it? DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 38 at r1 (raw file):
'Absent if the archive...' DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 55 at r1 (raw file):
I think this line can be removed from the Validate description DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 180 at r1 (raw file):
'desintation' lol DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 723 at r1 (raw file):
is that technically what disposing the archive does? Close it? Not saying it's wrong, just curious DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1203 at r1 (raw file):
'to determine' DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1245 at r1 (raw file):
$archiveEntryFullName DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1275 at r1 (raw file):
Could you add a comment here about what this check is checking? It's a little hard to follow DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1415 at r1 (raw file):
$archiveEntryFullName Comments from Reviewable |
6082964
to
09cf943
Compare
Review status: 0 of 25 files reviewed at latest revision, 10 unresolved discussions. README.md, line 15 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 21 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 38 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 55 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 180 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 723 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Part of the archive disposal is "all underlying streams are closed and no longer available for subsequent write operations." Technically it also removes any other resources held by the archive, not just the streams though. So it wouldn't be wrong to call this function Remove-Archive or Invoke-ArchiveDispose. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1203 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1245 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1275 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
I put it in a more descriptive variable instead since that's what I did down in the remove function DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1415 at r1 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Comments from Reviewable |
Reviewed 21 of 25 files at r1, 3 of 4 files at r2. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 209 at r2 (raw file):
one more spot - 'desintation' DSCResources/MSFT_xArchive/MSFT_xArchive.schema.mof, line 7 at r2 (raw file):
Can you remove 'The default Checksum method is ModifiedDate.' here too DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.schema.mfl, line 7 at r2 (raw file):
Remove Checksum comment here as well DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1, line 13 at r2 (raw file):
Extra space before the period at the end. DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1, line 33 at r2 (raw file):
'Comparing the hashes of the file at {0} and the archive entry at {1} with the hash algorithm {2}...' DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1, line 35 at r2 (raw file):
'FileMatchesArchiveEntryByChecksum' (instead of 'Files....') DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1, line 36 at r2 (raw file):
'FileDoesNotMatchArchiveEntryByChecksum' Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1, line 8 at r2 (raw file):
'corresponding' Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1, line 22 at r2 (raw file):
Maybe change to 'C:\TestArchivePath\Archive.zip' and 'C:\TestDestinationPath\Destination', just as an extra precaution since this is set to override files Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1, line 22 at r2 (raw file):
Same comment as above with naming Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1, line 27 at r2 (raw file):
Archive6 Examples/Sample_xArchive_RemoveArchiveChecksum.ps1, line 8 at r2 (raw file):
'corresponding' Examples/Sample_xArchive_RemoveArchiveChecksum.ps1, line 18 at r2 (raw file):
change path names Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1, line 18 at r2 (raw file):
change path names Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 127 at r2 (raw file):
I kind of like this better in the old structure putting the Enter-DscResourceTestEnvironment at the top and the Exit in the finally block - this gets lost within the rest of the code. Is there a reason you switched to this structure? Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 135 at r2 (raw file):
It 'Should return $false that the destination exists' Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 157 at r2 (raw file):
It 'Should return true that the destination exists after configuration' Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 161 at r2 (raw file):
It 'Should return that the file structure of destination matches the file structure of the archive' Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 205 at r2 (raw file):
It "Should return True that the item under destination $otherItemName should exist as a directory before configuration" Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 211 at r2 (raw file):
same as above Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 215 at r2 (raw file):
It "Should return that the file under destination $otherItemName has the expected contents before configuration" Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 362 at r2 (raw file):
Do you know the actual exception it will throw here? - That would be good to include Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 598 at r2 (raw file):
Is this line not being used anymore? (here and in all of the tests) Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 830 at r2 (raw file):
Wait, shouldn't all the extra files have been deleted? Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 40 at r2 (raw file):
Can you change these to 'Should statements' Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 86 at r2 (raw file):
This doesn't look like it's actually testing removing an archive since Test-TargetResouce is returning False when Ensure is set to Present and True when Ensure is set to Absent. Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 222 at r2 (raw file):
Again, this doesn't look like it's actually testing the removal of an Archive. Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 528 at r2 (raw file):
'...of the archive after Set-TargetResource' Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 532 at r2 (raw file):
Are all the extra tests above this one really necessary if this is supposed to just throw anyway? - I know these are the old tests, but it does make it a little hard to follow. - Also can we add what should actually be thrown here. Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 536 at r2 (raw file):
Could these be declared above the foreach loop since they're used in every Context block? Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 580 at r2 (raw file):
Again - this is looking like the archive is already absent. Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 620 at r2 (raw file):
'... of the archive after Set-TargetResource' Tests/Integration/MSFT_xArchive.TestHelper.psm1, line 68 at r2 (raw file):
'Returns the file path to the compressed zip file.' Comments from Reviewable |
Still working on the integration tests, but the rest is done Review status: 12 of 25 files reviewed at latest revision, 33 unresolved discussions. DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 209 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/MSFT_xArchive.schema.mof, line 7 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.schema.mfl, line 7 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1, line 13 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1, line 33 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1, line 35 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Wasn't used. Removed this string. DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1, line 36 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1, line 8 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Examples/Sample_xArchive_ExpandArchiveChecksumAndForce.ps1, line 22 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Examples/Sample_xArchive_ExpandArchiveDefaultValidationAndForce.ps1, line 22 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Examples/Sample_xArchive_ExpandArchiveNoValidationCredential.ps1, line 27 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
This example is still 1, but the others have changed so there is now 1-6 Examples/Sample_xArchive_RemoveArchiveChecksum.ps1, line 8 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Examples/Sample_xArchive_RemoveArchiveChecksum.ps1, line 18 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Examples/Sample_xArchive_RemoveArchiveNoValidation.ps1, line 18 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 127 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
I like it better in this structure. It fits into the Pester structure better rather than looking like a hack that we tacked on, and it looks cleaner to me with less brackets and less nesting. We also have all the imports together in one place this way. Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 135 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
I have tried changing all these test names you are commenting on to statements beginning with 'Should', but I think they all read much better the way they are now. I think we need to relax our insistence that these all begin with 'Should' and actually think about what is being tested here. Especially this one in particular since there is nothing that the code should or should not have done at this point. We are just ensuring that the test set-up is correct. Come talk to me if you still think these test names are really worth changing. Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 157 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
See comment above. Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 161 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
I did add 'after configuration' to this one to clarify it, but see comment above. Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 205 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
See above comment Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 211 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
See above comment Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 215 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
See above comment Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 362 at r2 (raw file):
No that's why this comment is there Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 598 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Replaced with the actual file structure test Tests/Integration/MSFT_xArchive.EndToEnd.Tests.ps1, line 830 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Nope. The Archive resource won't remove any extra files that were added to the destination. Tests/Integration/MSFT_xArchive.TestHelper.psm1, line 68 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Comments from Reviewable |
Review status: 11 of 25 files reviewed at latest revision, 33 unresolved discussions. Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 40 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Talked about this offline Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 86 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Fixed! Good catch! Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 222 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 528 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
This is still before Set-TargetResource? Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 532 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Yes because I need to make sure that the machine is in the correct state before Set-TargetResource is called Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 536 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Moved. Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 580 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
This one is actually correct. But I added tests before the edit as well to clarify what should be happening here. Tests/Integration/MSFT_xArchive.Integration.Tests.ps1, line 620 at r2 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Comments from Reviewable |
Reviewed 1 of 14 files at r3. Tests/Unit/MSFT_xArchive.Tests.ps1, line 933 at r3 (raw file):
Is the '*' here supposed to be? Tests/Unit/MSFT_xArchive.Tests.ps1, line 1837 at r3 (raw file):
I would add a test for the Checksum parameter name being shorter than 3 chars as well. Tests/Unit/MSFT_xArchive.Tests.ps1, line 3438 at r3 (raw file):
'Should set the last access time...' Tests/Unit/MSFT_xArchive.Tests.ps1, line 3450 at r3 (raw file):
'Should set the creation time...' Tests/Unit/MSFT_xArchive.Tests.ps1, line 4248 at r3 (raw file):
'Should not attempt to find....' Tests/Unit/MSFT_xArchive.Tests.ps1, line 4370 at r3 (raw file):
'Should not attempt to find...' Tests/Unit/MSFT_xArchive.Tests.ps1, line 4589 at r3 (raw file):
'Should not attempt to find...' Tests/Unit/MSFT_xArchive.Tests.ps1, line 4707 at r3 (raw file):
'Should not attempt to find...' Comments from Reviewable |
Reviewed 13 of 14 files at r3. Comments from Reviewable |
Review status: all files reviewed at latest revision, 9 unresolved discussions. Tests/Unit/MSFT_xArchive.Tests.ps1, line 933 at r3 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Unit/MSFT_xArchive.Tests.ps1, line 1837 at r3 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Unit/MSFT_xArchive.Tests.ps1, line 3438 at r3 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Unit/MSFT_xArchive.Tests.ps1, line 3450 at r3 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Unit/MSFT_xArchive.Tests.ps1, line 4248 at r3 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Unit/MSFT_xArchive.Tests.ps1, line 4370 at r3 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Unit/MSFT_xArchive.Tests.ps1, line 4589 at r3 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Tests/Unit/MSFT_xArchive.Tests.ps1, line 4707 at r3 (raw file): Previously, mbreakey3 (Mariah) wrote…
Done. Comments from Reviewable |
Reviewed 1 of 1 files at r4. Comments from Reviewable |
This is the high quality upgrade of xArchive for #160.
Unit tests, integration tests, end-to-end tests and examples have been added.
Documentation has been updated.
This fixes #127
This change is