-
Notifications
You must be signed in to change notification settings - Fork 225
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
Creating new PR with fixes from PR #59 #89
Conversation
@mbreakey3 Have a couple questions on this AppVeyor fails with ConvertTo-SecureString warning on pester tests. Is there a better way to handle this in these tests? Also MSFT_xSQLServerFirewall.schema.mof complains about not having a new line however I did not touch this file. |
FYI this will close 23 and 59 |
Yeah, so instead of using a string username/password, it should be declared as a [System.Management.Automation.PSCredential] |
And I'm not sure what happened with the mof file, but I would say just add the newline in |
So just add this to the top of that test file: # Suppressing this rule because PlainText is required for one of the functions used in this test
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param () Since it's a test file, the plaintext is acceptable, so we can just suppress the rule. I apologize for the confusion, I didn't catch this earlier |
I'm not quite sure what's going on with appVeyor either - I tried to re-build the commit, but it's not even showing up |
Ah, it's because of the merge conflicts, so if you can fix those, appVeyor should be able to run again |
So it looks like there's something wrong with how the module is getting imported in the tests. I would recommend starting with our unit test template and then copying your tests into that. |
@mbreakey3 Im missing something with these tests but not sure what the issue is can you take a look? |
Tests/Unit/MSFT_xSqlAlias.Tests.ps1, line 20 [r4] (raw file):
These should be switched: DSCModuleName is xSQLServer and DSCResourceName is MSFT_xSqlAlias Comments from Reviewable |
Tests/Unit/MSFT_xSqlAlias.Tests.ps1, line 76 [r5] (raw file):
I think this should be Get-TargetResource Comments from Reviewable |
Review status: 0 of 7 files reviewed at latest revision, 2 unresolved discussions. Tests/Unit/MSFT_xSqlAlias.Tests.ps1, line 20 [r4] (raw file):
|
@mbreakey3 Ok I think its finally a go once you approve the files. Thanks for all your help |
Review status: 0 of 7 files reviewed at latest revision, 5 unresolved discussions. Tests/Unit/MSFT_xSQLAOGroupEnsure.Tests.ps1, line 4 [r6] (raw file):
Delete all of the template-comments Tests/Unit/MSFT_xSQLAOGroupEnsure.Tests.ps1, line 99 [r6] (raw file):
since these 3 variables are used more than once you can move them up to the top of the describe block and call them $mockPassword, $mockUsername, $mockCredential Tests/Unit/MSFT_xSQLAOGroupEnsure.Tests.ps1, line 155 [r6] (raw file):
move these to the top of the describe block too, as mentioned above Comments from Reviewable |
Reviewed 1 of 6 files at r1, 1 of 1 files at r2, 1 of 4 files at r3. DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 30 [r6] (raw file):
None of these semi-colons should be needed Tests/Unit/MSFT_xSqlAlias.Tests.ps1, line 5 [r6] (raw file):
remove all template comments Tests/Unit/MSFT_xSqlAlias.Tests.ps1, line 72 [r6] (raw file):
Make sure tab space is aligned. There should be a 4 space indentation after each curly bracket Tests/Unit/MSFT_xSqlAlias.Tests.ps1, line 153 [r6] (raw file):
Again, just make sure to delete all of this excess code from the template Comments from Reviewable |
DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 30 [r6] (raw file):
|
Review status: 3 of 7 files reviewed at latest revision, 7 unresolved discussions. Tests/Unit/MSFT_xSqlAlias.Tests.ps1, line 5 [r6] (raw file):
|
Review status: 3 of 7 files reviewed at latest revision, 11 unresolved discussions. DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 79 [r7] (raw file):
If this is going to be declared up here it can just be se to $itemValue = '' (lowercase since a local variable) DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 253 [r7] (raw file):
Could you add some comments for what state each of these nested blocks represent? It's a little hard to follow DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 277 [r7] (raw file):
lowercase 'return' Tests/Unit/MSFT_xSqlAlias.Tests.ps1, line 5 [r6] (raw file):
|
Tests/Unit/MSFT_xSQLAOGroupEnsure.Tests.ps1, line 96 [r7] (raw file):
|
Review status: 3 of 7 files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 79 [r7] (raw file):
|
@aultt Just tested dev locally and all tests are passing: Going to test your branch locally now to see what's up. |
@aultt Your branch is passing as well: Gonna start messing with appveyor... |
Ok let me know if there is anything I need to do. On Tue, Aug 9, 2016 at 4:37 PM -0400, "Katie Keim" <[email protected]mailto:[email protected]> wrote: @aultthttps://github.com/aultt Your branch is passing as well: Gonna start messing with appveyor... You are receiving this because you were mentioned. |
@aultt Ok. I think I know what's going on here: When I run these tests locally, I do not originally have the 'Microsoft.SqlServer.Management.Smo.Server' type defined. Because I don't have this type defined, the tests load a 'fake' Microsoft.SqlServer.Management.Smo.Server from the SMO.cs stubs file in Tests\Unit. This definition of the type has a constructor that takes one boolean argument. The mocks in the Pester tests use this constructor with the one boolean. When these tests run on AppVeyor, however, the actual type Microsoft.SqlServer.Management.Smo.Server is already defined. Because the actual type is already defined, the Pester tests cannot redefine the type with the mocked type. The actual Microsoft.SqlServer.Management.Smo.Server does not have a constructor that takes one boolean as an argument. So, when AppVeyor tries to run the tests with the constrcutor with one boolean, the tests fail because the type defined on that machine does not have a constructor that takes those arguments. So how to solve this? |
Some code clean up. If you may :) Reviewed 1 of 6 files at r1, 2 of 3 files at r8, 4 of 9 files at r12. README.md, line 374 [r12] (raw file):
Remove the test that is not in this PR. README.md, line 376 [r12] (raw file):
Remove this blank line DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 11 [r12] (raw file):
Parameter with capital P. Can you change all of the "parameter" is changed to "Parameter" in the rest of this file? DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 20 [r12] (raw file):
This hash table is indented one step to much I think. DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 26 [r12] (raw file):
This { is indented to much too DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 164 [r12] (raw file):
Two blank lines here. Can your remove them? DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 167 [r12] (raw file):
One blank line to much here DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.schema.mof, line 2 [r12] (raw file):
Can you please add descriptions to all of these parameters in the schema file? DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.schema.mof, line 6 [r12] (raw file):
Shouldn't server name be Key as well? Not sure if this is a scenario, but otherwise we cannot use the same name on more than one server? Just want to make sure. DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1, line 135 [r12] (raw file):
Could you add space to all of these so its { "AllowNoConnections" }. And for the rest below as well DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1, line 153 [r12] (raw file):
Could you clean up the brackets {} and code in in these try-catch blocks? They are not indented correctly. Please go thru all try-catch blocks. Many seems to be out of place, indenting wise. DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1, line 261 [r12] (raw file):
Do you need Exit here when you are throwing? DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1, line 277 [r12] (raw file):
Please remove the blank spaces here DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1, line 344 [r12] (raw file):
Blank line here, and indenting seems wrong too. Comments from Reviewable |
Yea merging an old one in removed the AOGroupEnsure test will have to add to stub later. Comments from Reviewable |
DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.schema.mof, line 6 [r12] (raw file):
|
DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1, line 277 [r12] (raw file):
|
Review status: 2 of 6 files reviewed at latest revision, 27 unresolved discussions, some commit checks failed. README.md, line 374 [r12] (raw file):
|
@johlju I believe I have addressed all the items you requested @mbreakey3 can you review |
Reviewed 1 of 4 files at r3, 2 of 9 files at r12, 1 of 5 files at r13. README.md, line 329 [r13] (raw file):
'The TCP port' DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 33 [r13] (raw file):
Does $Name need to be in quotes here: -Name "$Name" ? DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 101 [r13] (raw file):
if (...) lowercase if and add space before parenthesis DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 108 [r13] (raw file):
$currentValue - lowercase DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 124 [r13] (raw file):
IfDSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 125 [r13] (raw file):
Get-WmiObject . DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 148 [r13] (raw file):
delete one of these newlines DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 153 [r13] (raw file):
'if (....) DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 155 [r13] (raw file):
space after # DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 162 [r13] (raw file):
space after # DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 163 [r13] (raw file):
Get-WmiObject -Class DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 203 [r13] (raw file):
space after [System.Boolean] DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 213 [r13] (raw file):
lowercase - $iremValue DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 215 [r13] (raw file):
lowercase $itemConfig DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 232 [r13] (raw file):
space after # (and all following comments as well DSCResources/MSFT_xSQLAlias/MSFT_xSQLAlias.psm1, line 233 [r13] (raw file):
Get-WmiObject -Class DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1, line 261 [r12] (raw file):
|
Reviewed 4 of 5 files at r13. README.md, line 374 [r12] (raw file):
|
Closing PR as I don't have additional time to allocate |
Closing as I don't have additional time to allocate |
@aultt If you don't have the time to continue. I'm would gladly continue with this PR. Is it possible to transfer the fork/PR over to me some way? @mbreakey3 Do you know if it's possible? |
@johlju The easiest way to pull his changes over to his fork is to just create a PR with the branch in your fork you want to merge these changes into as the base and aultt's dev branch as the head. You could also do it with git rebasing if you want to set up his dev branch as a remote to your fork and then rebase one of your branches onto his dev branch.
|
@mbreakey3 Then we have a new PR for this one in PR #114 |
Thanks @johlju I'll still be here just have to focus on some other things for now. |
Do not review on this PR further. All these comments are fixed in PR #114, continue the review process there. Review status: 5 of 6 files reviewed at latest revision, 41 unresolved discussions, some commit checks failed. README.md, line 329 [r13] (raw file):
|
@aultt That test you removed temporarily from this PR (because of the strange errors that was happening with it). Do you still have it? I would be awesome if you still have it, then I can incorporate that into the new PR and one more test is done. :) |
Corrected Merge conflicts which existed and 59
This change is