-
Notifications
You must be signed in to change notification settings - Fork 224
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
SqlServerLogin: Set default database #1485
SqlServerLogin: Set default database #1485
Conversation
@johlju I could use some help with unit testing the change. |
I won't have the bandwidth for a while, maybe you can look at the unit test and se how the property |
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.
@bozho Awesome work with the unit test, and code looks great! 😃 Just minor review comments. 🙂
Reviewed 7 of 8 files at r1, 1 of 2 files at r2, 1 of 1 files at r3.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on @bozho)
a discussion (no related file):
Can you add an example for setting default database? Add link to the example in the resource documentation in the README.md too.
CHANGELOG.md, line 13 at r3 (raw file):
.)
Move the full stop .
after the parentheses.
tests/Integration/MSFT_SqlServerLogin.config.ps1, line 106 at r3 (raw file):
SqlDatabase 'DefaultDb_Test'
Either add a configuration that removes this database again at the end, or update the integration documentation saying that the integration tests leaves the database, see here https://github.com/dsccommunity/SqlServerDsc/blob/master/tests/Integration/README.md#sqlserverlogin.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 194 at r3 (raw file):
"master"
We should use single-quote '
.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 198 at r3 (raw file):
"master"
We should use single-quote '
.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 203 at r3 (raw file):
"master"
We should use single-quote '
.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 209 at r3 (raw file):
"master"
We should use single-quote '
.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 294 at r3 (raw file):
Should -Not -BeNullOrEmpty
This should test so we get back the correct value Should -Be 'master'
(or what the correct database is in this test)
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 307 at r3 (raw file):
$result.DefaultDatabase | Should -Not -BeNullOrEmpty
This should test so we get back the correct value Should -Be 'master'
(or what the correct database is in this test)
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 320 at r3 (raw file):
$result.DefaultDatabase | Should -Not -BeNullOrEmpty
This should test so we get back the correct value Should -Be 'master'
(or what the correct database is in this test)
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 335 at r3 (raw file):
$result.DefaultDatabase | Should -Not -BeNullOrEmpty
This should test so we get back the correct value Should -Be 'master'
(or what the correct database is in this test)
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 622 at r3 (raw file):
$testTargetResource_SqlLoginPresentWithDefaultDatabaseMaster_EnsurePresent.Add( 'Ensure', 'Present' )
Non-blocking. This and those similar rows could be written like this which might be easier to read. But good as-is too.
$testTargetResource_SqlLoginPresentWithDefaultDatabaseMaster_EnsurePresent[ 'Ensure'] = 'Present'
…ServerDsc into issue-1474-sqllogin-default-db
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.
Reviewable status: 7 of 10 files reviewed, 12 unresolved discussions (waiting on @johlju)
a discussion (no related file):
Previously, johlju (Johan Ljunggren) wrote…
Can you add an example for setting default database? Add link to the example in the resource documentation in the README.md too.
Done.
CHANGELOG.md, line 13 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
.)
Move the full stop
.
after the parentheses.
Done.
tests/Integration/MSFT_SqlServerLogin.config.ps1, line 106 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
SqlDatabase 'DefaultDb_Test'
Either add a configuration that removes this database again at the end, or update the integration documentation saying that the integration tests leaves the database, see here https://github.com/dsccommunity/SqlServerDsc/blob/master/tests/Integration/README.md#sqlserverlogin.
How would I clean up at the end? Just add another Context
block which runs a "cleanup" configuration?
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 194 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
"master"
We should use single-quote
'
.
Done.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 198 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
"master"
We should use single-quote
'
.
Done.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 203 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
"master"
We should use single-quote
'
.
Done.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 209 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
"master"
We should use single-quote
'
.
Done.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 294 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Should -Not -BeNullOrEmpty
This should test so we get back the correct value
Should -Be 'master'
(or what the correct database is in this test)
Done.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 307 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$result.DefaultDatabase | Should -Not -BeNullOrEmpty
This should test so we get back the correct value
Should -Be 'master'
(or what the correct database is in this test)
Done.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 320 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$result.DefaultDatabase | Should -Not -BeNullOrEmpty
This should test so we get back the correct value
Should -Be 'master'
(or what the correct database is in this test)
Done.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 335 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$result.DefaultDatabase | Should -Not -BeNullOrEmpty
This should test so we get back the correct value
Should -Be 'master'
(or what the correct database is in this test)
Done.
tests/Unit/MSFT_SqlServerLogin.Tests.ps1, line 622 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$testTargetResource_SqlLoginPresentWithDefaultDatabaseMaster_EnsurePresent.Add( 'Ensure', 'Present' )
Non-blocking. This and those similar rows could be written like this which might be easier to read. But good as-is too.
$testTargetResource_SqlLoginPresentWithDefaultDatabaseMaster_EnsurePresent[ 'Ensure'] = 'Present'
Done.
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.
Reviewed 3 of 3 files at r4.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @bozho)
tests/Integration/MSFT_SqlServerLogin.config.ps1, line 106 at r3 (raw file):
Previously, bozho (Marko Bozikovic) wrote…
How would I clean up at the end? Just add another
Context
block which runs a "cleanup" configuration?
Yes, exactly, but you only need the It-block that Sets. I usually skip running the tests for Get and Test for those cleanup configurations.
@bozho great work on this! Just a fix for the integration tests and this can be merged 😃 |
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.
Reviewable status: 8 of 10 files reviewed, 1 unresolved discussion (waiting on @johlju)
tests/Integration/MSFT_SqlServerLogin.config.ps1, line 106 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Yes, exactly, but you only need the It-block that Sets. I usually skip running the tests for Get and Test for those cleanup configurations.
Done.
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.
Reviewed 2 of 2 files at r5.
Reviewable status: complete! all files reviewed, all discussions resolved
Pull Request (PR) description
Adds
DefaultDatabase
parameter.This Pull Request (PR) fixes the following issues
Task list
file CHANGELOG.md. Entry should say what was changed and how that
affects users (if applicable), and reference the issue being resolved
(if applicable).
and comment-based help.
This change is