Skip to content

Test fixes and code coverage automation fixes. - #5046

Merged
Dongbo Wang (daxian-dbw) merged 8 commits into
PowerShell:masterfrom
adityapatwardhan:testFixes
Oct 13, 2017
Merged

Dongbo Wang (daxian-dbw) merged 8 commits into
PowerShell:masterfrom
adityapatwardhan:testFixes

Conversation

@adityapatwardhan

Copy link
Copy Markdown
Member
  • About help test needed Update-Help
  • Tab completion tests were too stringent. There can be more than 1 matches.
  • Get-Process test should use $PID.
  • Improvements to Start-CodeCoverage script with respect to clean up and progress preference.
  • Removed code for uploading data to coveralls.
  • Added testexe path to $env:PATH

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is almost exactly the same as above, perhaps a helper function instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since you're modifying this, might as well fix the casing Remove-Item

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

And casing parameters too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Search replace out-file with Out-File

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

And casing parameters too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Leave a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe Should BeGreaterThan 0 - else next line can throw with useless message.

@adityapatwardhan Aditya Patwardhan (adityapatwardhan) Oct 9, 2017 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ilya (@iSazonov) Can you elaborate. I want to check it for being exactly 1. If the check fails, the next line will not be executed and the It will be marked as 'Failed'.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If $res.CompletionMatches.Count = 0 then $res.CompletionMatches[0] will throw with generic message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But if $res.CompletionMatches.Count = 2 and we are using Should BeGreaterThan 0 then the test might pass but we are getting more matches than expected.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder now - why are we removing this line with Should BeExactly 1 if we want just 1 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, I confused this with the about_help test. This can be BeGreaterThan 0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe Should BeGreaterThan 0 - else next line can throw with useless message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, I confused this with the about_help test. This can be BeGreaterThan 0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The same - maybe Should BeGreaterThan 0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

@adityapatwardhan

Copy link
Copy Markdown
Member Author

Steve Lee (@SteveL-MSFT) your feedback has been answered. Please have a look.

@daxian-dbw

Copy link
Copy Markdown
Member

Chatted with Aditya Patwardhan (@adityapatwardhan) offline and we found it strange that the Should complete about help topic test would fail, because we carry help content files in the package, and we pull it down from nuget package in build. So there shouldn't be a need to call update-help. Aditya Patwardhan (@adityapatwardhan) will investigate further to see what might be the root cause.

@adityapatwardhan

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) The updateable help system tests blow away the help and do not restore them. https://github.com/PowerShell/PowerShell/blob/master/test/powershell/engine/Help/UpdatableHelpSystem.Tests.ps1#L180

@daxian-dbw

Copy link
Copy Markdown
Member

Aditya Patwardhan (@adityapatwardhan) Thanks for finding the root cause! It looks to me that that test shouldn't remove all about*.txt files, as it's testing module help contents and it shouldn't be a problem for about*.txt files to be present. Right?

@adityapatwardhan

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) your feedback has been answered. Please have a look.

@daxian-dbw Dongbo Wang (daxian-dbw) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@adityapatwardhan

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) I added another test fix. Please have a look.

@adityapatwardhan

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) All tests have passed. Please have a look.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It will skip the tests on Unix plats. Is that intentional?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe

$skipTest = (Get-Command 'ssh' -ErrorAction SilentlyContinue) -eq $null 

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point. Fixed.

@adityapatwardhan

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) I have updated the tests and all tests pass.

@daxian-dbw

Copy link
Copy Markdown
Member

Aditya Patwardhan (@adityapatwardhan) Can you please take a look at the test failures in Travis CI?

@adityapatwardhan

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) Thanks for the update.

@adityapatwardhan

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) All tests passed. Ready for merge.

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 486fb97 into PowerShell:master Oct 13, 2017
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
* Test fixes and updates to code coverage automation
* Fixed UpdatableHelpSystem tests and tab completion tests
* Fixed tab completion tests to better disambiguate root/interop namespace.
* Skip SSH test if ssh.exe is not present
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.

4 participants