-
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
Added xSQLServerScript Resource #68
Conversation
Hi @dcrreynolds, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
The automated test are not fans of using UserName and Password, however, it directly matches how Invoke-SqlCmd works. I opted to leave it matching Invoke-SqlCmd to stay consistent with the cmdlet, but am open to changing it too. |
Any opinions of this? Do we follow the PowerShell standard and use a PSCred object, or use the Invoke-SqlCmd language and update the test to not fail here. |
I believe everything else in xSqlServer is utilizing PSCred Object so for consistency I would go with PSCred |
Reviewed 1 of 5 files at r2, 2 of 3 files at r3. README.md, line 278 [r3] (raw file):
Typo here - "this will not cause a the Test to return false." Tests/Unit/MSFT_xSQLServerScript.Test.ps1, line 8 [r3] (raw file):
Take out comments from template - also the tests templates recently got updated to change these variables from global to script, so can you change both of these to be $script: variables? Comments from Reviewable |
$Variable | ||
) | ||
|
||
Import-Module -Name SQLPS -WarningAction SilentlyContinue -ErrorAction Stop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the latest updates to SSMS the SQLPS module was renamed to SQLServer so baring this in mind should we not have a check in here for the change of module name for this along the lines of
If (Get-Module SQLPS -ListAvailable)
{
Write-Verbose "SQLPS Module Found"
$module = Get-Module SQLPS -ListAvailable
}
else
{
Write-Verbose "SQLPS Module Not found - Using updated SQLServer module "
$module = Get-Module SQLServer -ListAvailable
}
Import-Module $module -WarningAction SilentlyContinue -ErrorAction Stop
Though this would need to be actioned in the same way across all of the resources where this is currently in place
Referenced this in #91 as well
Thanks for the feedback! I'll get this fixed up. |
@dcrreynolds - My thoughts would be to deal with the last comment as per #91 (with a better suggestion in there too) in a separate PR just thought it needed to be called out as being something that needed to be thought of thats all |
Unit test cases had variable global scope removed, removed completed Todo comments.
…erverScript # Conflicts: # README.md
@mbreakey3 I've added your changes in, however, Reviewable keeps crashing and will not let me mark the comments as done. @kilasuit I would agree with updating the resource as one PR for #91 it will help ensure the fix is done uniformly. |
Reviewed 1 of 2 files at r4. Tests/Unit/MSFT_xSQLServerScript.Test.ps1, line 29 [r4] (raw file):
We're also not using the InModuleScope anymore for testing exported functions due to the fact that it can lead to conflicts. Tests/Unit/MSFT_xSQLServerScript.Test.ps1, line 89 [r4] (raw file):
Since you're mocking these same commands for almost all of these It statements you can create a Context block (which is almost the same as a Describe block) and put all of the It statements that use that mocked function within that Context block and just declare the mock once at the top of that Context block Comments from Reviewable |
Just started over with the test using the current unit test template. |
Reviewed 1 of 5 files at r2, 2 of 3 files at r3, 1 of 2 files at r4, 1 of 1 files at r5. DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1, line 30 [r3] (raw file):
|
Review status: all files reviewed at latest revision, 8 unresolved discussions. DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1, line 167 [r5] (raw file):
|
Review status: all files reviewed at latest revision, 9 unresolved discussions. DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1, line 108 [r5] (raw file):
A suggestion or and idea. Might not work for your intended behavior. Seems like most of the code is the same as in the Get-method. Would it work to call the Get-method from the Test-method instead? Looks like you could save a few lines of code. Comments from Reviewable |
Review status: all files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. Tests/Unit/MSFT_xSQLServerScript.Test.ps1, line 29 [r4] (raw file):
|
Reviewed 1 of 1 files at r5. Comments from Reviewable |
…erverScript # Conflicts: # README.md
Review status: 2 of 5 files reviewed at latest revision, 9 unresolved discussions. README.md, line 278 [r3] (raw file):
|
Reviewed 1 of 3 files at r6. README.md, line 334 [r6] (raw file):
Script or replication? It should be the same across the board Tests/Unit/MSFT_xSQLServerScript.Test.ps1, line 2 [r6] (raw file):
.SYNOPSIS should be in all caps - also can you indent the contents of the block comment? Comments from Reviewable |
Review status: 3 of 5 files reviewed at latest revision, 7 unresolved discussions. DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1, line 30 [r3] (raw file):
|
Review status: 2 of 5 files reviewed at latest revision, 4 unresolved discussions. README.md, line 334 [r6] (raw file):
|
Reviewed 3 of 3 files at r7. DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1, line 167 [r5] (raw file):
|
Reviewed 1 of 3 files at r6, 3 of 3 files at r7. Comments from Reviewable |
xSQLServerScript resource to extend DSCs Get/Set/Test functionality to T-SQL
This change is