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

SqlServiceAccount: Updated Get-ServiceObject to find SSIS service #1246

Merged
merged 49 commits into from
Jan 14, 2019
Merged

SqlServiceAccount: Updated Get-ServiceObject to find SSIS service #1246

merged 49 commits into from
Jan 14, 2019

Conversation

twerthi
Copy link

@twerthi twerthi commented Oct 20, 2018

Pull Request (PR) description

Get-ServiceObject calls the Get-SqlServiceName function which searches the registry for the specified service type. For SSIS, it correctly finds the service and returns MsDtsServer. Get-ServiceObject then searches the $managedComputer.Services collection comparing the Name property with the returned value and fails as the collection contains MsDtsServer130. Changed the operator from -eq to -like with an * after $serviceNameFilter. This should still function correctly with instances as well.

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-io commented Oct 20, 2018

Codecov Report

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

Impacted file tree graph

@@          Coverage Diff          @@
##            dev   #1246    +/-   ##
=====================================
+ Coverage    98%     98%   +<1%     
=====================================
  Files        34      34            
  Lines      4171    4197    +26     
=====================================
+ Hits       4111    4137    +26     
  Misses       60      60

@twerthi
Copy link
Author

twerthi commented Oct 22, 2018

What is the protocol when the build fails, but it's not related to a change I made? Am I to fix it?

@twerthi twerthi closed this Oct 24, 2018
@twerthi twerthi reopened this Oct 24, 2018
@twerthi
Copy link
Author

twerthi commented Oct 24, 2018

Please let me know if there are any outstanding tasks I need to do.

@johlju johlju added the needs review The pull request needs a code review. label Oct 25, 2018
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.

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

a discussion (no related file):
Please add a unit test that test this new functionality(ies) in SqlServiceAccount.


a discussion (no related file):
Please also add a separate unit test that tests the new helper function. See other comment about making it a generic helper function (so the unit test should be added to the correct .Tests.ps1 file).



CHANGELOG.md, line 58 at r2 (raw file):

    unit test ([issue #983](https://github.com/PowerShell/SqlServerDsc/issues/983)).
- Changes to SqlServiceAccount
  - Fixed Get-ServiceObject when searching for IntegrationServices service

Could we end the sentence with a full stop (.)?


CHANGELOG.md, line 60 at r2 (raw file):

  - Fixed Get-ServiceObject when searching for IntegrationServices service
- Changes to SqlServiceAccount
  - Added code to allow for using Managed Service Accounts

Could we end the sentence with a full stop (.)?


DSCResources/MSFT_SqlServiceAccount/MSFT_SqlServiceAccount.psm1, line 287 at r2 (raw file):

$_.Name -like "$serviceNameFilter*"

I think this will return multiple objects if there are two instances that are named almost the same, i.e. MSSQL$TEST1, MSSQL$TEST11?


DSCResources/MSFT_SqlServiceAccount/MSFT_SqlServiceAccount.psm1, line 456 at r2 (raw file):

        Type of service account.
#>
function Get-ServiceAccount

This helper function have similarities to the Get-ServiceAccountParameters helper function. Could we possibly make this a generic helper function instead of duplicating the regex logic? 🤔
https://github.com/PowerShell/SqlServerDsc/blob/3714325ef731719da3e7e949ebaa278588e05ab9/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1#L2237-L2290

Generic helper functions (that are used by more than one resource) exist in https://github.com/PowerShell/SqlServerDsc/blob/dev/SqlServerDscHelper.psm1

@johlju johlju added waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. and removed needs review The pull request needs a code review. labels Oct 25, 2018
@twerthi
Copy link
Author

twerthi commented Oct 26, 2018

Let me look into the helper function.

@johlju johlju added needs review The pull request needs a code review. and removed waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. labels Oct 27, 2018
@johlju
Copy link
Member

johlju commented Oct 27, 2018

@twerthi Great work on this! When you have time, can you look at the lint errors here https://ci.appveyor.com/project/PowerShell/sqlserverdsc/builds/19832432?fullLog=true#L2172

@johlju johlju added waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. and removed needs review The pull request needs a code review. labels Oct 27, 2018
@twerthi
Copy link
Author

twerthi commented Oct 30, 2018

@johlju The build is failing stating that there were commands missed in code coverage. I'm not familiar with what it's trying to tell me, would you be able to provide some explanation? I'll gladly fix it, just not sure what it's saying :)

@twerthi
Copy link
Author

twerthi commented Oct 31, 2018

That last commit isn't right, not validating password on disabled accounts. I see a need where someone would want to change a password of a disabled account such as sa, which is often disabled. I will fix that.

@twerthi twerthi closed this Oct 31, 2018
@twerthi twerthi reopened this Oct 31, 2018
@twerthi twerthi closed this Oct 31, 2018
@twerthi twerthi reopened this Oct 31, 2018
@twerthi
Copy link
Author

twerthi commented Nov 1, 2018

AppVeyor has been unable to build this project. I have it hooked up to my repository and each failure is something different. Mostly it's out of memory exceptions, but it will sometimes not be able to install SQL so the tests themselves fail. Is there a way to have AppVeyor give the containers more RAM?

@johlju
Copy link
Member

johlju commented Nov 2, 2018

Default it seems the containers use as much memory as they need. https://docs.docker.com/engine/reference/run/#user-memory-constraints

Maybe the constraint is the build worker. The build worker do install several instances in parallel with the containers. The integration tests is running when the containers are running unit tests. The instances (except one I think) is stopped by the integration test as a final test. Maybe before That they ett to much memory of the build worker (or the build worker does not dynamically allocate more memory fast enough).
If removing all integration tests does the containers finish successfully?

If they do, maybe we have to look how to optimize or remove integration tests.

@twerthi
Copy link
Author

twerthi commented Nov 2, 2018

Removed integration tests and trying on my repository ... which I think is tied to this PR so that commit is in there too. Please don't merge until we are able to resolve. Should I close the PR?

@twerthi
Copy link
Author

twerthi commented Nov 2, 2018

Hmm, looks like it still fails. I'm a bit out of my element here, any advice?

@twerthi
Copy link
Author

twerthi commented Nov 2, 2018

Going to close PR and run a build just on my repository to see if the two running at the same time is causing issues.

@twerthi twerthi closed this Nov 2, 2018
@twerthi
Copy link
Author

twerthi commented Nov 3, 2018

It's hit or miss as to whether it works. I'll reopen.

@twerthi twerthi reopened this Nov 3, 2018
@twerthi twerthi closed this Nov 3, 2018
Added some missing properties of the login.
moved assert mock called checks to see if that's the problem.
Scoping for Assert-MockCalled was incorrect for the test that tests disabled logins.
Still trying to understand the logic to get the test to work.
Removed the mock, but forgot to remove the assert-mockcalled
The assert-mockcalled command was before the method that was to call the mock.
Reviewed updated requested and updated.  Still need to get test working.
Exceeded line length, updated the text to break it up.
Re-adding mock for Get-TargetResource
Forgot to add logintype property
Trying to get properties for mock user correct so the test will function.
Confirmed unit test is now testing the correct code pathway.
Updated error section to use MissingParameter localized data instead of unknown service type.
Removed tab character from msft_sqlserviceaccount.strings.psd1
Updated changelog, readme for textual request.  Removed commented out line in msft_sqlserverlogin.tsts.ps1
Updated ChangeLog so my changes were in Unlreleased.

Refactored method to not use the negative (!) notation for readability.

Added tests to test all code paths of new code.
Further explained what is happening in comment block.
@johlju
Copy link
Member

johlju commented Jan 13, 2019

@twerthi I rebased this against dev to remove the 'merge...' commits. You probably did git pull or git merge. But wanted to make sure the commit history was in the right order so did git rebase, and to make sure there was no changes I missed that the merge might have done.

@johlju
Copy link
Member

johlju commented Jan 13, 2019

@twerthi I will make sure this pass the tests and then I will merge. Awesome work on this PR! 😄

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 10 of 35 files at r20.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@johlju johlju closed this Jan 13, 2019
@johlju johlju reopened this Jan 13, 2019
@johlju johlju closed this Jan 13, 2019
@johlju johlju reopened this Jan 13, 2019
@twerthi
Copy link
Author

twerthi commented Jan 14, 2019

Oh! That is most likely the case, I used the UI and did merges, I didn't know there was a difference between merge an rebase. Looks like I'll have get more familiar with the command line of Git instead of utilizing the GUI of GitHub :)

@johlju johlju merged commit e8e14af into dsccommunity:dev Jan 14, 2019
@johlju
Copy link
Member

johlju commented Jan 14, 2019

@twerthi Maybe there is a way of doing rebase through GUI as well? If you didn't know, rebase takes the dev branch and add that to you branch, then it replays all the commits you did. While 'git merge' sees the difference between dev and you branch and add a commit with the difference. Basically.

@johlju
Copy link
Member

johlju commented Jan 14, 2019

@twerthi I have finally merge this! Again, awesome work!

@johlju johlju removed the ready for merge The pull request was approved by the community and is ready to be merged by a maintainer. label Jan 14, 2019
@twerthi
Copy link
Author

twerthi commented Jan 18, 2019

@johlju I appreciate the help you gave me. I'll see if I can practice my Git command line :)

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.

SqlServerLogin: fails test for Disabled sql logins everytime
3 participants