Skip to content

Conversation

@anmenaga
Copy link

@anmenaga anmenaga commented Feb 2, 2018

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:
beforefix

Test results (test\powershell\engine\Help) after fix:
afterfix

PR Checklist

Note: Please mark anything not applicable to this PR NA.

@anmenaga anmenaga added the WG-Quality-Test issues in a test or in test infrastructure label Feb 2, 2018
{
param ([string]$ModuleName, [string]$Tag = 'CI')

# Update-Help fails if module path is Not writable, so skip tests in this situation
Copy link
Collaborator

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?

Copy link
Member

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.

Copy link
Collaborator

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?

Copy link
Member

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
Copy link
Collaborator

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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.

@adityapatwardhan
Copy link
Member

adityapatwardhan commented Feb 20, 2018

@anmenaga Now that RequiresSudoOnUnix is available. We can simplify the logic over here. Please have a look at: #6145

@adityapatwardhan
Copy link
Member

I believe #6223 should fix the issue this PR is trying to fix.
@anmenaga if you agree, please close the PR.

@anmenaga
Copy link
Author

this is covered by #6223 .

@anmenaga anmenaga closed this Mar 14, 2018
@anmenaga anmenaga deleted the UpdateHelpTestUpdates branch October 31, 2018 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WG-Quality-Test issues in a test or in test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants