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

ScheduledTask: Resolved inconsistent treatment of BuiltInAccount property. #313

Merged
merged 7 commits into from
Mar 25, 2020

Conversation

wm-wilson
Copy link
Contributor

@wm-wilson wm-wilson commented Feb 28, 2020

Pull Request (PR) description

Fixed inconsistent treatment of the BuiltInAccount property for the ScheduledTask resource.
The Set method prefixes the "SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE" account names with the "NT Authority" domain.
This results in a scheduled task that runs, but the DSC resource test will always fail on the BuiltInAccount property check. For example:
Expected = 'SYSTEM'
Actual = 'NT Authority\SYSTEM.'

Added integration test cases for the ServiceAccount Logontype/BuiltInAccount property, demonstrating the above.

This Pull Request (PR) fixes the following issues

None

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 in resource folder.
  • Resource parameter descriptions added/updated in 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

Added missing "NT Authority\" prefix to BuiltInAccount property in the resource Test method.
Added test cases using the ServiceAccount logonType and BuiltInAccount properties.
@PlagueHO PlagueHO added needs review The pull request needs a code review. waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. labels Feb 29, 2020
@PlagueHO
Copy link
Member

Hi @wm-wilson - thanks for submitting this! Great submission. It looks like the tests are failing. Can you take a look at this?

Fixed unit test 'When a scheduled task is created using a Built In Service Account' - the Get-ScheduledTask mock needed updating to match the current observed behaviour.
@wm-wilson
Copy link
Contributor Author

@PlagueHO - sorry about that, fixed the unit test to match the current observed behaviour from Get-ScheduledTask.

@wm-wilson
Copy link
Contributor Author

Apologies if I've missed some protocol here. I submitted the test fix 12 days ago but the pull request is still labelled as "waiting for codefix". Is there something else I need to do to indicate that this is ready for further review?

@PlagueHO PlagueHO removed the waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. label Mar 19, 2020
@PlagueHO
Copy link
Member

Hi @wm-wilson - sorry about the delay. It is waiting on me to complete the review. I'll get onto this over the weekend. Been a bit snowed under with projects.

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

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

Looking great @wm-wilson - just one minor tweak and we're good to go. Thanks for submitting this.

Reviewed 4 of 4 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @wm-wilson)


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

## [Unreleased]

- ScheduledTask:

Can you add a ### Added (or ### Fixed) header above this?


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

- ScheduledTask:
  - Added missing 'NT Authority\' domain prefix when testing tasks that use the BuiltInAccount property.

Could you also add: - Fixes [Issue #317](https://github.com/dsccommunity/ComputerManagementDsc/issues/317). to the end of the change here? See

Moved changelog entry from the [Unreleased] to the Fixed heading. Linked to the issue fixed by this change.
@wm-wilson
Copy link
Contributor Author

@PlagueHO - Hopefully I got that right.

No worries re. the delay - I suspect we've all got lots of plates spinning right now!

@wm-wilson wm-wilson closed this Mar 23, 2020
@wm-wilson wm-wilson reopened this Mar 23, 2020
@wm-wilson
Copy link
Contributor Author

PEBKAC

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @wm-wilson)


CHANGELOG.md, line 48 at r3 (raw file):

    error in `Test-TargetResource` - Fixes [Issue #297](https://github.com/dsccommunity/ComputerManagementDsc/issues/297).
- ScheduledTask:
  - Added missing 'NT Authority\' domain prefix when testing tasks that use the BuiltInAccount property.

Nitpick: Can you append the - Fixes onto the end of the line above (e.g. so it is clear it is related). E.g.

- Updated to use continuous delivery pattern using Azure DevOps - Fixes
  [Issue #295](https://github.com/dsccommunity/ComputerManagementDsc/issues/295).

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

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

I suspect we've all got lots of plates spinning right now!
Haha yes, indeed we do! But we'll get there. 😁 just one tweak and I'll merge!

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @wm-wilson)

Moved line break in Changelog entry to make it clearer that the fix and issue are related.
@wm-wilson
Copy link
Contributor Author

Changelog corrected. Thanks!

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r4.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @wm-wilson)


CHANGELOG.md, line 47 at r4 (raw file):

  - Fix `A parameter cannot be found that matches parameter name 'Ensure'.`
    error in `Test-TargetResource` - Fixes [Issue #297](https://github.com/dsccommunity/ComputerManagementDsc/issues/297).
- ScheduledTask:

Strange - this seems to have moved down to the [8.0.0] section rather than under unreleased? Can you move it up? Sorry about the pain -not sure what happened there...?

Moved WindowsCapability fix back to [Unreleased] at the request of PlagueHO
@wm-wilson
Copy link
Contributor Author

Done!

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r5.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @wm-wilson)


CHANGELOG.md, line 8 at r5 (raw file):

## [Unreleased]

- WindowsCapability:

Doh! Sorry @wm-wilson - it needs to be under a section called ### Fixed

E.g. what we should have is:

## [Unreleased]

### Fixed

- Fix `A parameter cannot be found that matches parameter name 'Ensure'.`
  error in `Test-TargetResource` - Fixes [Issue #297](https://github.com/dsccommunity/ComputerManagementDsc/issues/297).

## [8.0.0] - 2020-02-14

The reason for all this is that the automated deployment code uses this specific structure to generate the release notes.

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

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

Hi @wm-wilson - I merged another PR and so it might have changed my example below, so you should end up with:

## [Unreleased]

### Added

- ComputerManagementDsc
  - Added build task `Generate_Conceptual_Help` to generate conceptual help
    for the DSC resource.
  - Added build task `Generate_Wiki_Content` to generate the wiki content
    that can be used to update the GitHub Wiki.

### Changed

- ComputerManagementDsc
  - Updated CI pipeline files.
  - No longer run integration tests when running the build task `test`, e.g.
    `.\build.ps1 -Task test`. To manually run integration tests, run the
    following:
    ```powershell
    .\build.ps1 -Tasks test -PesterScript 'tests/Integration' -(needs review) 

Fixed

  • Updated to use continuous delivery pattern using Azure DevOps - Fixes
    Issue #295.

[8.0.0] - 2020-02-14

Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @wm-wilson)

Copy link
Member

@PlagueHO PlagueHO 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 1 of 1 files at r7.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@PlagueHO PlagueHO merged commit 1ae52d5 into dsccommunity:master Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review The pull request needs a code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants