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

Fix Integration Test Failures in xArchive and General Code Quality improvements - Fixes #457 #472

Merged
merged 17 commits into from
Jan 19, 2019

Conversation

PlagueHO
Copy link
Member

@PlagueHO PlagueHO commented Jan 12, 2019

Pull Request (PR) description

This primarily fixes the broken integration tests for xArchive, but also improves the code to make it more readable and testable.

It also improves tests so that they can run on machines without US date format and addresses the issue with archives that use forward slash.

I also started to include improvements that we've made to many of the other repos (such as .VSCode analyzer settings, .gitattributes, style corrections).

Full details:

* xArchive
  * Fix end-to-end tests ([issue #457](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/457)).
  * Update integration tests to meet Pester 4.0.0 standards.
  * Update end-to-end tests to meet Pester 4.0.0 standards.
  * Update unit and integration tests to meet Pester 4.0.0 standards.
  * Wrapped all verbose message parameters with quotes to make identifying
    actual paths possible.
  * Refactored date/time checksum code to improve testability and ensure
    tests can run on machines with localized datetime formats that are not
    US.
  * Fix 'Get-ArchiveEntryLastWriteTime' to return `[datetime]` ([issue #471](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/471)).
  * Improved verbose logging to make debugging path issues easier.
  * Added handling for '/' as a path seperator ([issue #469](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/469)).
* Added .gitattributes file and removed git configuration from AppVeyor
  to ensure CRLF settings are configured correctly for the repository.
* Updated '.vscode\settings.json' to refer to AnalyzerSettings.psd1 so that
  custom syntax problems are highlighted in Visual Studio Code.
* Fixed style guideline violations in `CommonResourceHelper.psm1`.

This Pull Request (PR) fixes the following issues

Issue #458 also does not seem to be an issue any more although I didn't make any specific change to fix it (I actually suspect this was fixed by using the correct .gitattributes with an inclusion for binaries).

Task list

  • Added an entry under the Unreleased section of the change log in the README.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.

@johlju , @mgreenegit, @kwirkykat - could any of you review as this should sort out the blocking issue you mentioned at the community call.


This change is Reviewable

@codecov-io
Copy link

Codecov Report

Merging #472 into dev will increase coverage by <1%.
The diff coverage is 90%.

Impacted file tree graph

@@         Coverage Diff          @@
##            dev   #472    +/-   ##
====================================
+ Coverage    72%    72%   +<1%     
====================================
  Files        27     27            
  Lines      4016   4022     +6     
  Branches      4      4            
====================================
+ Hits       2916   2921     +5     
- Misses     1096   1097     +1     
  Partials      4      4

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 11 of 11 files at r1, 2 of 2 files at r2.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @PlagueHO)


README.md, line 722 at r2 (raw file):

verbose message parameters

Maybe something like "...verbose messages containing path strings now sorrounds the path with qoutes..."? Users might not know what you mean with "message parameters" I think 🤔


DSCResources/MSFT_xArchive/MSFT_xArchive.psm1, line 1193 at r2 (raw file):

    )

    return $ArchiveEntryName.EndsWith('\') -or $ArchiveEntryName.EndsWith('/')

Looks like a regular expression could simplify this, but since this is backported from PSDscResource, let leave it as-is. 🙂


Tests/Unit/MSFT_xArchive.Tests.ps1, line 2097 at r1 (raw file):

$PSScriptRoot

Minor: Even if it is not actually used (creating files), shouldn't we have $TestDrive here instead? Throughout.


Tests/Unit/MSFT_xArchive.Tests.ps1, line 2196 at r1 (raw file):

creation time

last write time?

Copy link
Member Author

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

Should be good to review again @johlju! 😁 Thanks again

Reviewable status: 8 of 11 files reviewed, 3 unresolved discussions (waiting on @johlju)


README.md, line 722 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
verbose message parameters

Maybe something like "...verbose messages containing path strings now sorrounds the path with qoutes..."? Users might not know what you mean with "message parameters" I think 🤔

Done.

Reworded slightly


Tests/Unit/MSFT_xArchive.Tests.ps1, line 2097 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
$PSScriptRoot

Minor: Even if it is not actually used (creating files), shouldn't we have $TestDrive here instead? Throughout.

Done.


Tests/Unit/MSFT_xArchive.Tests.ps1, line 2196 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
creation time

last write time?

Good catch. Fixed!

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 3 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @PlagueHO)


Tests/Unit/MSFT_xArchive.Tests.ps1, line 2196 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

Good catch. Fixed!

Can't see you changed this? 🙂

Copy link
Member Author

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

Sorry @johlju - forgot to save the file. Fixed now.

Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @johlju)


Tests/Unit/MSFT_xArchive.Tests.ps1, line 2196 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Can't see you changed this? 🙂

Doh! Forgot to save the file.

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:

Haha happens to me too 😄 Awesome work on this!

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

@johlju
Copy link
Member

johlju commented Jan 19, 2019

@PlagueHO No, you didn't send in a commit on this! 😆 I just hit LGTM, and then looked after the change. 😞
I LGTM again when you send in the commit 😄

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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @PlagueHO)


Tests/Unit/MSFT_xArchive.Tests.ps1, line 2192 at r4 (raw file):

creation time

Still not last write time here?

Copy link
Member Author

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

Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @johlju)


Tests/Unit/MSFT_xArchive.Tests.ps1, line 2192 at r4 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
creation time

Still not last write time here?

Sorry @johlju - I was looking and correcting the wrong line! Should be good to go.

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

@PlagueHO PlagueHO merged commit 524b5a6 into dsccommunity:dev Jan 19, 2019
@PlagueHO PlagueHO deleted the Issue-470 branch January 19, 2019 20:53
mhendric added a commit to mhendric/xPSDesiredStateConfiguration that referenced this pull request Jan 26, 2019
mhendric added a commit that referenced this pull request Jan 27, 2019
Fixes files which are getting triggered for re-encoding after recent checkin (possibly #472)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants