-
Notifications
You must be signed in to change notification settings - Fork 17
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
fix for Issue #8 #9
fix for Issue #8 #9
Conversation
@J0F3 If I review this PR do you have time to work on it? |
Please rebase this PR to get newly merged changes. Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed. README.md, line 8 at r1 (raw file):
We should not remove this. README.md, line 102 at r1 (raw file):
If an entry resolves an issue please reference the issue where applicable. You may suffix (it's optional) each entry with your name. Example of the format for the entry.
Misc/xBitlockerCommon.psm1, line 424 at r1 (raw file):
We should use single quotes where applicable. Throughout this row. Misc/xBitlockerCommon.psm1, line 523 at r1 (raw file):
We should use single quotes where applicable. Test/Unit/xBitlockerCommon.tests.ps1, line 5 at r1 (raw file):
This should move back one indent. Test/Unit/xBitlockerCommon.tests.ps1, line 17 at r1 (raw file):
We should start Context -block with 'When...'. Throughout. Test/Unit/xBitlockerCommon.tests.ps1, line 17 at r1 (raw file):
We should use single quotes where applicable. Throughout this file. Test/Unit/xBitlockerCommon.tests.ps1, line 33 at r1 (raw file):
We should have open brace on a separate row. Test/Unit/xBitlockerCommon.tests.ps1, line 66 at r1 (raw file):
This should use `Should -Not -Throw' Test/Unit/xBitlockerCommon.tests.ps1, line 86 at r1 (raw file):
We should have open brace on a separate row. Comments from Reviewable |
c16071b
to
21a70f4
Compare
Codecov Report
@@ Coverage Diff @@
## dev #9 +/- ##
=======================================
Coverage 26.08% 26.08%
=======================================
Files 3 3
Lines 92 92
=======================================
Hits 24 24
Misses 68 68 Continue to review full report at Codecov.
|
When you have resolved the review comments, or if you need to discuss a comment. Could you please go into Reviewable and write 'Done' (or click the done-button) on each of the review comments. This allows me to acknowledge (resolve) the review comments and I know that you are done with each change. After you written 'Done' on each review comment, or comment on the review comment if it needs further discussion, then click the big green 'Publish' button on top of the page. That will send all your comments back as one big comment to this PR. |
Review status: 0 of 4 files reviewed at latest revision, 10 unresolved discussions, some commit checks failed. README.md, line 8 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. README.md, line 102 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Misc/xBitlockerCommon.psm1, line 424 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Misc/xBitlockerCommon.psm1, line 523 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Test/Unit/xBitlockerCommon.tests.ps1, line 5 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Test/Unit/xBitlockerCommon.tests.ps1, line 17 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Test/Unit/xBitlockerCommon.tests.ps1, line 17 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Test/Unit/xBitlockerCommon.tests.ps1, line 33 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Test/Unit/xBitlockerCommon.tests.ps1, line 66 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Test/Unit/xBitlockerCommon.tests.ps1, line 86 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Comments from Reviewable |
Review status: 0 of 4 files reviewed at latest revision, 10 unresolved discussions. Test/Unit/xBitlockerCommon.tests.ps1, line 86 at r1 (raw file): Previously, J0F3 (Jonas Feller) wrote…
Can not do that because this will alter the logic of the mocked function. (return value will be null and not the hash table) Comments from Reviewable |
Sorry about the delay. I have rebased the PR and looked through the comments now. |
Review status: all files reviewed at latest revision, 1 unresolved discussion. Test/Unit/xBitlockerCommon.tests.ps1, line 17 at r1 (raw file): Previously, J0F3 (Jonas Feller) wrote…
Please also use single quotes around description for Context- and It-blocks. Throughout. Test/Unit/xBitlockerCommon.tests.ps1, line 86 at r1 (raw file): Previously, J0F3 (Jonas Feller) wrote…
Sorry, I'm not following you here :/ The code here looks good to me. Test/Unit/xBitlockerCommon.tests.ps1, line 23 at r3 (raw file):
We can move the param block to the 'empty function' so we don't have to duplicate that in every mock. Throughout. Comments from Reviewable |
Review status: 3 of 4 files reviewed at latest revision, 2 unresolved discussions. Test/Unit/xBitlockerCommon.tests.ps1, line 23 at r3 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Comments from Reviewable |
Review status: 3 of 4 files reviewed at latest revision, 2 unresolved discussions. Test/Unit/xBitlockerCommon.tests.ps1, line 86 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
I thought that you mean the open brace of the hash table of the return value should be on a separate row but you probably meant the brace after the else just above. So everything fine anyway :-) Comments from Reviewable |
I also have just realized that we had now two unit tests for xBitlockerCommon.ps1. So I just merged mine into the file under Tests\Unit so we have just one file with all test in it. |
Looking good now! Just a tiny review comment left 🙂 Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed. Tests/Unit/xBitlockerCommon.tests.ps1, line 193 at r4 (raw file):
If we mock If we mock
I throw me twice now thinking why the test fail but did not report failure 😃 Test/Unit/xBitlockerCommon.tests.ps1, line 86 at r1 (raw file): Previously, J0F3 (Jonas Feller) wrote…
Ah, yes, it was the else open brace I meant :) Comments from Reviewable |
There are merge conflicts since your PR was not based on the latest changes. Could you please rebase against branch dev using |
1bac4b2
to
eff6c05
Compare
I have rebased again against dev so merge conflict should be resolved now... Review status: 2 of 4 files reviewed at latest revision, 1 unresolved discussion. Tests/Unit/xBitlockerCommon.tests.ps1, line 193 at r4 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Ah that's what I was looking into but could not find a solution how to get rid of the error output. Test/Unit/xBitlockerCommon.tests.ps1, line 86 at r1 (raw file): Previously, johlju (Johan Ljunggren) wrote…
👍 Comments from Reviewable |
Review status: all files reviewed at latest revision, all discussions resolved. Tests/Unit/xBitlockerCommon.tests.ps1, line 193 at r4 (raw file): Previously, J0F3 (Jonas Feller) wrote…
Looking good! Just a few tweaks, and I think we are all good 🙂 See other comments. Tests/Unit/xBitlockerCommon.tests.ps1, line 33 at r6 (raw file):
This should not be needed for cmdlets that are part of "default PowerShell". LEt's try without this. Tests/Unit/xBitlockerCommon.tests.ps1, line 199 at r6 (raw file):
I think it should be enough with If Tests/Unit/xBitlockerCommon.tests.ps1, line 204 at r6 (raw file):
Should be Tests/Unit/xBitlockerCommon.tests.ps1, line 204 at r6 (raw file):
This comment is non-blocking, meaning code is good as-is, but mentioning if you want to try it.
Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. Tests/Unit/xBitlockerCommon.tests.ps1, line 33 at r6 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Yup, works without. 👍 Tests/Unit/xBitlockerCommon.tests.ps1, line 199 at r6 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Ah, learned again something. thx :-) (removed the -MockWith) Tests/Unit/xBitlockerCommon.tests.ps1, line 204 at r6 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Tests/Unit/xBitlockerCommon.tests.ps1, line 204 at r6 (raw file): Previously, johlju (Johan Ljunggren) wrote…
|
Review status: 3 of 4 files reviewed, 3 unresolved discussions (waiting on @johlju) Tests/Unit/xBitlockerCommon.tests.ps1, line 204 at r6 (raw file): Previously, J0F3 (Jonas Feller) wrote…
Happy to help. It should look something like this. NOTE! You must remove the stub
Comments from Reviewable |
Review status: 3 of 4 files reviewed, 4 unresolved discussions (waiting on @johlju) Tests/Unit/xBitlockerCommon.tests.ps1, line 204 at r6 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Thank you very much! I got it now (I think :-) ). The error output was actually from the Write-Error statements in the code and not from the Throw. I miss interpreted that. So I rewritten the whole this a little bit and added also a test case for server core without the needed features which was completely missing before. Further I added also some test for the Get-OSEdition function so we have that also covered. Tests/Unit/xBitlockerCommon.tests.ps1, line 197 at r7 (raw file):
Not sure if this is the right solution. Actually I testing here always two things. But could not find any other way to suppress the exception from throw so I can only test for the Write-Error messages. Comments from Reviewable |
Reviewed 1 of 1 files at r7. Tests/Unit/xBitlockerCommon.tests.ps1, line 141 at r7 (raw file):
We don't need this when we don't mock any logic. This can be removed. Throughout the mocks. Tests/Unit/xBitlockerCommon.tests.ps1, line 143 at r7 (raw file):
Should be Tests/Unit/xBitlockerCommon.tests.ps1, line 197 at r7 (raw file): Previously, J0F3 (Jonas Feller) wrote…
I don't think there is a way to mock I think this is the correct way. You want to test what happens in the code, and the code calls The problem is probably the code. It should just build a string and throw one correct error message, or use Comments from Reviewable |
Review status: all files reviewed, 2 unresolved discussions (waiting on @johlju) Tests/Unit/xBitlockerCommon.tests.ps1, line 141 at r7 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Done. Tests/Unit/xBitlockerCommon.tests.ps1, line 143 at r7 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Doh! Missed that again... 🤦♂️ Tests/Unit/xBitlockerCommon.tests.ps1, line 197 at r7 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Ok, fine. Comments from Reviewable |
…mes for Assert-MockCalled
Reviewed 1 of 1 files at r8. Tests/Unit/xBitlockerCommon.tests.ps1, line 143 at r7 (raw file): Previously, J0F3 (Jonas Feller) wrote…
You only have to specify the name of a named parameter until it's unique, like Tests/Unit/xBitlockerCommon.tests.ps1, line 197 at r7 (raw file): Previously, J0F3 (Jonas Feller) wrote…
That solution returning a Boolean would be even better yes. 🙂 Good as-is for now. Comments from Reviewable |
@J0F3 Awesome work on this one! Thanks! 😃 |
Thanks @johlju and thank you for your support! 😊 |
Pull Request (PR) description
Added a Check in the CheckForPreReqs Function so that the installation of the Windows Feature "RSAT-Feature-Tools-BitLocker-RemoteAdminTool" on Server Core because it is only available on Full Server.
This Pull Request (PR) fixes the following issues:
Fixes #8
This change is