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

ADGroup: Refactor Module, Unit and Integration Tests #631

Merged
merged 14 commits into from
Jan 24, 2021

Conversation

X-Guardian
Copy link
Contributor

@X-Guardian X-Guardian commented Nov 1, 2020

Pull Request (PR) description

This PR refactors the module, unit and integration tests of the ADGroup resource as follows:

  • Remove non mandatory parameters from Get-TargetResource.
  • Remove nested Try/Catch blocks from Get-TargetResource.
  • Refactor Test-TargetResource to use Compare-ResourcePropertyState common function.
  • Refactor Set-TargetResource to use Compare-ResourcePropertyState common function.
  • Modify membership add/Remove to use Compare-Object to only add/remove changed members.
  • Fix Set-ADCommonGroupMember function so parameters are not changed.
  • Fix Credential parameter description.
  • Enhance integration tests to use a data driven pattern.
  • Enhance unit tests to use contexts and newer standard test patterns.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (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 Community Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

@codecov
Copy link

codecov bot commented Nov 1, 2020

Codecov Report

❗ No coverage uploaded for pull request base (main@45379fc). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##             main   #631   +/-   ##
=====================================
  Coverage        ?    98%           
=====================================
  Files           ?     25           
  Lines           ?   3408           
  Branches        ?      0           
=====================================
  Hits            ?   3340           
  Misses          ?     68           
  Partials        ?      0           

@stale stale bot added the abandoned The pull request has been abandoned. label Nov 17, 2020
@X-Guardian X-Guardian removed the abandoned The pull request has been abandoned. label Nov 21, 2020
@dsccommunity dsccommunity deleted a comment from stale bot Nov 21, 2020
@X-Guardian X-Guardian marked this pull request as ready for review November 22, 2020 10:27
@X-Guardian X-Guardian requested a review from johlju November 22, 2020 10:27
@johlju johlju added the needs review The pull request needs a code review. label Nov 23, 2020
@davidwallis
Copy link

any further progress with this?

@johlju johlju changed the base branch from master to main January 5, 2021 16:32
@johlju
Copy link
Member

johlju commented Jan 5, 2021

It is on my todo list to review.

@johlju johlju self-requested a review January 5, 2021 17:04
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 3 of 5 files at r2, 1 of 1 files at r3.
Reviewable status: 4 of 11 files reviewed, all discussions resolved (waiting on @johlju)


source/DSCResources/MSFT_ADGroup/MSFT_ADGroup.psm1, line 103 at r3 (raw file):

            # This FullyQualifiedErrorId is indicative of a failure to retrieve members with Get-ADGroupMember
            # for a one-way trust

We should use comment-block on comments that are more than one row. Throughout the code.

<#
    This FullyQualifiedErrorId is indicative of a failure to retrieve members with Get-ADGroupMember
    for a one-way trust
#>

source/DSCResources/MSFT_ADGroup/MSFT_ADGroup.psm1, line 366 at r3 (raw file):

 [HashTable] $parameters = $PSBoundParameters

This does not really create a new hashtable? 🤔 [HashTable] $parameters = @{} + $PSBoundParameters would. 🤔

@johlju
Copy link
Member

johlju commented Jan 5, 2021

@X-Guardian I started the review but I is such a big change that I have not time to review it properly. You may merge this if you feel it is ready, and fix any problems after that.

If someone else have time to review the code fell free to do so.

@X-Guardian X-Guardian merged commit 9346a1d into dsccommunity:main Jan 24, 2021
@X-Guardian X-Guardian deleted the ADGroup-Refactor branch January 24, 2021 16:33
@johlju johlju removed the needs review The pull request needs a code review. label Jul 6, 2021
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.

ADGroup: Seemingly removing members even if they are present in property Members
3 participants