Skip to content
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

SqlServerEndpoint : Add parameter "Owner" #1271

Merged
merged 4 commits into from
Jan 25, 2019
Merged

SqlServerEndpoint : Add parameter "Owner" #1271

merged 4 commits into from
Jan 25, 2019

Conversation

mdaniou
Copy link
Contributor

@mdaniou mdaniou commented Jan 21, 2019

Pull Request (PR) description

Adding the parameter "Owner" to allow to specify it at creation
It seems like there is no integration test for this resource.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry under the Unreleased section of the change log in the CHANGELOG.md.
    Entry should say what was changed, and how that affects users (if applicable).
  • Resource documentation added/updated in README.md.
  • Resource parameter descriptions added/updated in README.md, schema.mof
    and comment-based help.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Resource Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Resource Testing Guidelines.
  • New/changed code adheres to DSC Resource Style Guidelines and Best Practices.

This change is Reviewable

@codecov-io
Copy link

Codecov Report

Merging #1271 into dev will increase coverage by <1%.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##            dev   #1271    +/-   ##
=====================================
+ Coverage    97%     97%   +<1%     
=====================================
  Files        34      34            
  Lines      4197    4208    +11     
=====================================
+ Hits       4106    4117    +11     
  Misses       91      91

@johlju johlju added the needs review The pull request needs a code review. label Jan 23, 2019
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this! 🙂 Just a couple of comments, one a logical error I think in the Test-TargetResource function.

Reviewed 1 of 6 files at r1, 5 of 5 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @mdaniou)


DSCResources/MSFT_SqlServerEndpoint/MSFT_SqlServerEndpoint.psm1, line 302 at r2 (raw file):

elseif ($getTargetResourceResult.Ensure -eq 'Present' -and $Owner)

Instead of this, shouldn't we check this like Port and IpAddress are checked in the if-block above? 🤔

        if ($getTargetResourceResult.Ensure -eq 'Present' `
                -and (
                        $getTargetResourceResult.Port -ne $Port `
                    -or $getTargetResourceResult.IpAddress -ne $IpAddress
                    -or $getTargetResourceResult.Owner-ne $Owner
                )
        )

Tests/Unit/MSFT_SqlServerEndpoint.Tests.ps1, line 333 at r2 (raw file):

 listener IP address

should me 'owner' here in the comment?

@johlju
Copy link
Member

johlju commented Jan 23, 2019

@mdaniou There hasn't been a integration test written for this resource yet, so I will no enforce it. There is another issue open to get an integration tests for this resource. 🙂

@mdaniou
Copy link
Contributor Author

mdaniou commented Jan 24, 2019

@johlju I am actually working on the integration test for this resource.

@johlju
Copy link
Member

johlju commented Jan 24, 2019

Oh that is awesome! 😄 Is your plan to add it to this PR or send in a new PR with the integration test? Either way works for me.

Copy link
Contributor Author

@mdaniou mdaniou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 4 of 6 files reviewed, 2 unresolved discussions (waiting on @johlju)


DSCResources/MSFT_SqlServerEndpoint/MSFT_SqlServerEndpoint.psm1, line 302 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
elseif ($getTargetResourceResult.Ensure -eq 'Present' -and $Owner)

Instead of this, shouldn't we check this like Port and IpAddress are checked in the if-block above? 🤔

        if ($getTargetResourceResult.Ensure -eq 'Present' `
                -and (
                        $getTargetResourceResult.Port -ne $Port `
                    -or $getTargetResourceResult.IpAddress -ne $IpAddress
                    -or $getTargetResourceResult.Owner-ne $Owner
                )
        )

Well I did that at first then I realized that if $Owner parameter is null then it will fail as the owner is set at creation and is the login used to actually create it :) . Hence the comparison won't work. I need to test only if the parameter is filled.
However I now figure that my code is incomplete. It should be :

elseif ($getTargetResourceResult.Ensure -eq 'Present' -and $Owner `
		-and $getTargetResourceResult.Owner -ne $Owner
)

Tests/Unit/MSFT_SqlServerEndpoint.Tests.ps1, line 333 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
 listener IP address

should me 'owner' here in the comment?

Indeed

Copy link
Contributor Author

@mdaniou mdaniou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 4 of 6 files reviewed, 2 unresolved discussions (waiting on @johlju)


DSCResources/MSFT_SqlServerEndpoint/MSFT_SqlServerEndpoint.psm1, line 302 at r2 (raw file):

Previously, mdaniou (Maxime Daniou) wrote…

Well I did that at first then I realized that if $Owner parameter is null then it will fail as the owner is set at creation and is the login used to actually create it :) . Hence the comparison won't work. I need to test only if the parameter is filled.
However I now figure that my code is incomplete. It should be :

elseif ($getTargetResourceResult.Ensure -eq 'Present' -and $Owner `
		-and $getTargetResourceResult.Owner -ne $Owner
)

Done.


Tests/Unit/MSFT_SqlServerEndpoint.Tests.ps1, line 333 at r2 (raw file):

Previously, mdaniou (Maxime Daniou) wrote…

Indeed

Done.

@mdaniou
Copy link
Contributor Author

mdaniou commented Jan 24, 2019

I will keep them separate as I started working on it after I created this PR. No need to mix up everything :)

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@johlju johlju merged commit f601a9d into dsccommunity:dev Jan 25, 2019
@johlju johlju removed the needs review The pull request needs a code review. label Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SqlServerEndpoint : Should let us choose the owner
3 participants