-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Update-Help test updates #6093
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
Update-Help test updates #6093
Conversation
| { | ||
| param ([string]$ModuleName, [string]$Tag = 'CI') | ||
|
|
||
| # Update-Help fails if module path is Not writable, so skip tests in this situation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the path can be read only if we run the tests with 'RequireAdminOnWindows' tag? Do you means Unix where we haven't still such tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we do not run the tests under sudo on Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should not complicate these tests if we want to implement #5645?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we need to go through a bunch to tests when #5645 is done. We can revert these changes then.
| { | ||
| $readonly = $_.Exception.GetType().Name -eq 'UnauthorizedAccessException' | ||
| } | ||
| Remove-Item -Path $filepath -ErrorAction SilentlyContinue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add -Force.
| { | ||
| param ([string]$ModuleName, [string]$Tag = 'CI') | ||
|
|
||
| # Update-Help fails if module path is Not writable, so skip tests in this situation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we do not run the tests under sudo on Linux.
| $modulesInBox = @("Microsoft.PowerShell.Core" | ||
| Get-Module -ListAvailable | ForEach-Object{$_.Name} | ||
| ) | ||
| function PathIsReadOnly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this function to a common file and then dot source it in both the test files.
| $skip = PathIsReadOnly $modulePath | ||
| } | ||
|
|
||
| # -Skip and -$Pending are mutually exclusive on It block, so skip Pending tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skip and Pending have specific meanings. you can use splatting to choose one of them for the It block.
|
this is covered by #6223 . |
PR Summary
Currently building PS is required on a test machine for a test pass to succeed.
One of the test work items is to decouple test passes from build requirement; i.e. tests should be runnable on released PS packages.
This PR fixes test code (Update-Help tests) that currently fail on released PS packages.
Test results (

test\powershell\engine\Help) before fix:Test results (

test\powershell\engine\Help) after fix:PR Checklist
Note: Please mark anything not applicable to this PR
NA.[feature]if the change is significant or affects feature testsWIP:to the beginning of the title and remove the prefix when the PR is ready.