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

Restore-TestEnvironment: New parameter KeepNewMachinePSModulePath #128

Merged
merged 6 commits into from
May 17, 2023

Conversation

johlju
Copy link
Member

@johlju johlju commented May 17, 2023

Pull Request (PR) description

  • Restore-TestEnvironment
    • A new parameter KeepNewMachinePSModulePath was added and only works
      if the test type is Integration or All. The new parameter will
      keep any new paths that was added to the machine environment variable
      PSModulePath after the command Initialize-TestEnvironment was called.
      This is helpful if a a path is added by an integration test and is needed
      by a second integration test and there is a need to run Restore-TestEnvironment
      between tests.
  • Added private function Join-PSModulePath that will concatenate two
    strings with semi-colon separated paths.
  • Initialize-TestEnvironment
    • Now $script:machineOldPSModulePath is always set when called with the
      test type Integration or All. Before it reverted to the paths on the
      event OnRemove that were the current paths when Initialize-TestEnvironment
      was first called. On subsequent calls any new paths were ignored.
    • If there are a subsequent call to Initialize-TestEnvironment without the
      command Restore-TestEnvironment was called prior the command will now
      fail with a non-terminating exception asking the user to run Restore-TestEnvironment
      to avoid the previously saved paths ($script:machineOldPSModulePath)
      to be overwritten.

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).
  • Documentation added/updated in README.md.
  • 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 May 17, 2023

Codecov Report

Merging #128 (a457108) into main (73d6c32) will increase coverage by 0%.
The diff coverage is n/a.

❗ Current head a457108 differs from pull request most recent head ee1dd15. Consider uploading reports for the commit ee1dd15 to get more accurate results

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #128   +/-   ##
===================================
  Coverage    80%    80%           
===================================
  Files         1      1           
  Lines       539    547    +8     
===================================
+ Hits        432    440    +8     
  Misses      107    107           

see 1 file with indirect coverage changes

Copy link
Member Author

@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 8 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion


tests/Unit/Public/Initialize-TestEnvironment.Tests.ps1 line 116 at r1 (raw file):

                    TestType        = $TestType
                    ResourceType    = $ResourceType
                    ErrorAction     = 'SilentlyContinue'

Should be removed.

Copy link
Member Author

@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.

Reviewable status: 7 of 8 files reviewed, all discussions resolved (waiting on @johlju)


tests/Unit/Public/Initialize-TestEnvironment.Tests.ps1 line 116 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Should be removed.

Done

Copy link
Member Author

@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 1 of 1 files at r2.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on @johlju)

Copy link
Member Author

@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 all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @johlju)

@johlju johlju merged commit b73c287 into dsccommunity:main May 17, 2023
@johlju johlju deleted the fix/issue#127 branch May 17, 2023 15:17
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.

Restore-TestEnvironment: New PSModulePath in target Machine is overwritten
1 participant