-
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
Convert xService to HQRM #216
Conversation
* First commit. Unit tests incomplete * Further unit tests added. * More unit tests added. * Further unit tests * Added more unit tests * Unit tests added. * Remove test scaffolding * More unit tests completed * Fixes and more unit tests * More unit tests completed * More unit tests. Major fix * Added more unit tests * Added more unit tests * More unit tests created * Additional unit tests * Add unit tests * Fix integration and unit tests * Fix integration tests * Fix integration tests * Fix integration tests * More integration tests * Fix to integration tests * Unit tests complete
Squash merge PSSA Violations
I had to comment and say that you do some awesome work @PlagueHO !! |
@PlagueHO Should the file |
Same question in regards to the file |
Thank you so much @johlju, I really appreciate the compliment 😄 Good catch on the additional files - some of the tests are a little badly behaved and don't clean up after themselves. I raised an issue to get the I'll remove these files from my PR tomorrow and raise another issue to get the tests that create the Cheers for the heads up! |
Thought I give it a try to review such a large PR. A few comments. So many changes but I could only find style fixes. Impressive. 😄 Reviewed 7 of 12 files at r1. DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 44 [r1] (raw file):
You change this variable from DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 211 [r1] (raw file):
Could we make this variable more descriptive? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 379 [r1] (raw file):
Maybe add to the comment that the function DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 408 [r1] (raw file):
Could we add a blank line before this if-statement? And also fo the rest of the if-blocks below. DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 438 [r1] (raw file):
Is DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 581 [r1] (raw file):
Could we add a blank line before this return statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 600 [r1] (raw file):
Could we add a blank line before this If statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 604 [r1] (raw file):
Could we add a blank line before this return statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 687 [r1] (raw file):
Capital 'P' here DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 712 [r1] (raw file):
Maybe make this local variable more descriptive? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 773 [r1] (raw file):
Can this parameter be more descriptive? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 800 [r1] (raw file):
Can we add a blank line before this If-statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 804 [r1] (raw file):
Can we add a blank line before this If-statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 808 [r1] (raw file):
Can we add a blank line before this If-statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 816 [r1] (raw file):
Could we add a blank line before this line? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 847 [r1] (raw file):
Can we add a blank line before this If-statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 872 [r1] (raw file):
Could we make this parameter more descriptive? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 907 [r1] (raw file):
Could we make this parameter more descriptive? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 918 [r1] (raw file):
Can you also describe here in what order user and password are returned? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 960 [r1] (raw file):
This function uses a hardcoded value to sleep. Maybe submit an issue so this can be a parameter in the feature (and maybe use something like DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 971 [r1] (raw file):
Could we add a blank line before this for-statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 978 [r1] (raw file):
Could we add a blank line before this comment? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 982 [r1] (raw file):
Could we add a blank line before this if-statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 1124 [r1] (raw file):
Could we add a blank line before the switch-statement? DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 1146 [r1] (raw file):
Could we add a blank line before the return-statement? DSCResources/MSFT_xServiceResource/en-US/MSFT_xServiceResource.strings.psd1, line 45 [r1] (raw file):
Using Tests/Integration/MSFT_xServiceResource_add.config.ps1, line 10 [r1] (raw file):
Could we add a blank space before this row? To separate it from the param block. Tests/Integration/MSFT_xServiceResource_add.config.ps1, line 11 [r1] (raw file):
Could we add a blank space before this row? To separate it from the Import-module "block". Tests/Integration/MSFT_xServiceResource_remove.config.ps1, line 6 [r1] (raw file):
Could we add a blank space before this row? To separate it from the param block. Tests/Integration/MSFT_xServiceResource_remove.config.ps1, line 7 [r1] (raw file):
Could we add a blank space before this row? To separate it from the Import-module "block". Comments from Reviewable |
@johlju @Dan1el42 - I've removed both these files and added the change to the Readme.md. We still need to fix up the tests so that StdErrorPath.txt doesn't get created. I'll log an issue to get this one solved. Thank you heaps for the reivew @johlju - really appreciate it (especially as I know how big the change is 😄 ) Review status: 7 of 12 files reviewed at latest revision, 30 unresolved discussions. DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 44 [r1] (raw file):
|
* First commit. Unit tests incomplete * Further unit tests added. * More unit tests added. * Further unit tests * Added more unit tests * Unit tests added. * Remove test scaffolding * More unit tests completed * Fixes and more unit tests * More unit tests completed * More unit tests. Major fix * Added more unit tests * Added more unit tests * More unit tests created * Additional unit tests * Add unit tests * Fix integration and unit tests * Fix integration tests * Fix integration tests * Fix integration tests * More integration tests * Fix to integration tests * Unit tests complete * Fix for PSSA rules * Update xProcessSet/xPackageResource tests Integration tests of the resources xProcessSet and xPackageResource updated to create the temporary output files in the Pester TestDrive directory instead of the repository being tested to avoid these files to be committed upstream. * Fix #215: Running tests creates/updates file in repo * Changes as per PR comments
So far I have only gone thru checking style in the test Reviewed 1 of 12 files at r1, 12 of 12 files at r2. DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 44 [r1] (raw file):
|
I did try to keep the logic to the original resource (in all it's terrible glory). I've fixed up any obvious issues (there were several). I'd love someone to do a logic review on it, but I think a far better plan would be to extend the Integration tests further as that is likely to catch more problems than a logic review would catch. I'm not overly fond of the way this resource was written, but there is no way we should even think of refactoring it until the test coverage is in place. This includes fixing issues (which is why I've put so much time into getting tests in place). Anyway, thanks again for the very thorough review 😄 Review status: all files reviewed at latest revision, 126 unresolved discussions. DSCResources/MSFT_xServiceResource/MSFT_xServiceResource.psm1, line 44 [r1] (raw file):
|
* First commit. Unit tests incomplete * Further unit tests added. * More unit tests added. * Further unit tests * Added more unit tests * Unit tests added. * Remove test scaffolding * More unit tests completed * Fixes and more unit tests * More unit tests completed * More unit tests. Major fix * Added more unit tests * Added more unit tests * More unit tests created * Additional unit tests * Add unit tests * Fix integration and unit tests * Fix integration tests * Fix integration tests * Fix integration tests * More integration tests * Fix to integration tests * Unit tests complete * Fix for PSSA rules * Update xProcessSet/xPackageResource tests Integration tests of the resources xProcessSet and xPackageResource updated to create the temporary output files in the Pester TestDrive directory instead of the repository being tested to avoid these files to be committed upstream. * Fix #215: Running tests creates/updates file in repo * Changes as per PR comments * Changes as per PR comments
Reviewed 3 of 3 files at r3. Tests/Integration/MSFT_xServiceResource.Integration.Tests.ps1, line 59 [r3] (raw file):
Tests/Integration/MSFT_xServiceResource.Integration.Tests.ps1, line 101 [r3] (raw file):
Tests/Unit/MSFT_xServiceResource.Tests.ps1, line 1136 [r2] (raw file):
|
Hopefully I've got all the changes now (I said that last time though :) ). Thanks again @johlju for reviewing Review status: all files reviewed at latest revision, 15 unresolved discussions. Tests/Integration/MSFT_xServiceResource.Integration.Tests.ps1, line 59 [r3] (raw file):
|
* First commit. Unit tests incomplete * Further unit tests added. * More unit tests added. * Further unit tests * Added more unit tests * Unit tests added. * Remove test scaffolding * More unit tests completed * Fixes and more unit tests * More unit tests completed * More unit tests. Major fix * Added more unit tests * Added more unit tests * More unit tests created * Additional unit tests * Add unit tests * Fix integration and unit tests * Fix integration tests * Fix integration tests * Fix integration tests * More integration tests * Fix to integration tests * Unit tests complete * Fix for PSSA rules * Update xProcessSet/xPackageResource tests Integration tests of the resources xProcessSet and xPackageResource updated to create the temporary output files in the Pester TestDrive directory instead of the repository being tested to avoid these files to be committed upstream. * Fix #215: Running tests creates/updates file in repo * Changes as per PR comments * Changes as per PR comments * Fixes as per PR comments
Almost... two left :) Reviewed 2 of 2 files at r4. Tests/Unit/MSFT_xServiceResource.Tests.ps1, line 1589 [r2] (raw file):
|
Hopefully this time :) Committing now. Review status: all files reviewed at latest revision, 3 unresolved discussions. Tests/Unit/MSFT_xServiceResource.Tests.ps1, line 1589 [r2] (raw file):
|
* First commit. Unit tests incomplete * Further unit tests added. * More unit tests added. * Further unit tests * Added more unit tests * Unit tests added. * Remove test scaffolding * More unit tests completed * Fixes and more unit tests * More unit tests completed * More unit tests. Major fix * Added more unit tests * Added more unit tests * More unit tests created * Additional unit tests * Add unit tests * Fix integration and unit tests * Fix integration tests * Fix integration tests * Fix integration tests * More integration tests * Fix to integration tests * Unit tests complete * Fix for PSSA rules * Update xProcessSet/xPackageResource tests Integration tests of the resources xProcessSet and xPackageResource updated to create the temporary output files in the Pester TestDrive directory instead of the repository being tested to avoid these files to be committed upstream. * Fix #215: Running tests creates/updates file in repo * Changes as per PR comments * Changes as per PR comments * Fixes as per PR comments * Fix as per PR comments
I think this can be as good as it can be. Left one comment for @kwirkykat to reply to. Reviewed 1 of 1 files at r5. Comments from Reviewable |
@PlagueHO This is awesome. Review status: all files reviewed at latest revision, 1 unresolved discussion. Tests/Unit/MSFT_xServiceResource.Tests.ps1, line 58 [r2] (raw file):
|
Thanks @kwirkykat - I really appreciate that 😄 Review status: all files reviewed at latest revision, 1 unresolved discussion. Tests/Unit/MSFT_xServiceResource.Tests.ps1, line 58 [r2] (raw file):
|
This PR converts the xService resource to HQRM standards, but also implements full unit and integration tests. These tests exposed various issues which have also been resolved.
I also fixed the PSSA issues.
Fixes
Changes to xService
I apologize (to the reviewers 😄 ) for the size of this PR, but a lot of code changes were required to bring this up to HQRM and to implement decent unit test coverage. I expect similar sized PR's for the other resources in this module as they all have similar problems (destructive unit tests and/or no actual unit tests).
Once this PR is merged I'll feel more comfortable addressing the other xService issues (when I get time - unless someone else gets to them first):
This change is