Skip to content

Pass -UserScope as required by RunUpdateHelpTests - #13400

Merged
Dongbo Wang (daxian-dbw) merged 28 commits into
PowerShell:masterfrom
yecril71pl:patch-6
May 22, 2023
Merged

Dongbo Wang (daxian-dbw) merged 28 commits into
PowerShell:masterfrom
yecril71pl:patch-6

Conversation

@yecril71pl

Copy link
Copy Markdown
Contributor

PR Summary

The function RunUpdateHelpTests does not expect to get Scope but UserScope. I modified the calls accordingly.

PR Context

I am lost why passing a Scope to a function that accepts UserScope would have any good results. I think the current behaviour is that the tests are skipped because $userscope -eq $false, as evidenced by the following test log entry:

Validate Update-Help -SourcePath for all PowerShell modules for user scope..Validate Update-Help for module 'Microsoft.PowerShell.Core' with scope as 'False'

… and erroneously marked as passed.

PR Checklist

I am lost why passing a **Scope** to a function that accepts **UserScope** would have any good results.  I think the current behaviour is that the tests are skipped because `-not $userscope`, as evidenced by the following test log entry: 

> Validate Update-Help -SourcePath for all PowerShell modules for user scope..Validate Update-Help for module 'Microsoft.PowerShell.Core' with scope as 'False'

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

We lost this tracking in #6352 (comment)

{

It "Validate Update-Help for module '$moduleName' with scope as '$userscope'" -Skip:(!(Test-CanWriteToPsHome) -and $userscope -eq $false) {
It "Validate Update-Help for module '$moduleName' with user scope as '$userscope'" -Skip:(!(Test-CanWriteToPsHome) -and $userscope -eq $false) {

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.

It is not correct. Please try something like:

Suggested change
It "Validate Update-Help for module '$moduleName' with user scope as '$userscope'" -Skip:(!(Test-CanWriteToPsHome) -and $userscope -eq $false) {
It "Validate Update-Help for module '$moduleName' with $(if ($userscope) 'User' else 'AllScope') scope" -Skip:(!(Test-CanWriteToPsHome) -and $userscope -eq $false) {

@iSazonov Ilya (iSazonov) added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Aug 11, 2020
$params = @{Path = $testCases[$moduleName].HelpInstallationPath}
$updateScope = @{Scope = 'AllUsers'}
}
It "Validate Update-Help for module '$moduleName' in '$updateScope'" -Skip:(!(Test-CanWriteToPsHome) -and $userscope -eq $false) {

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.

'$updateScope' returns "System.Collections.Hashtable". Yes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am deeply ashamed of myself. I assumed it would be nicely expanded in a string. I am working on it.

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.

We could simply add new variable for the test name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would rather be as deep to the metal as possible in a test log.

@adityapatwardhan

Copy link
Copy Markdown
Member

Christopher Yeleighton (@yecril71pl) Thank you for your PR. Please have a look at the failures.

@adityapatwardhan Aditya Patwardhan (adityapatwardhan) added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Aug 11, 2020
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Aug 11, 2020

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

Christopher Yeleighton (@yecril71pl) 99% of the PR is unrelated changes. Please fix only UserScope issue and move rest of changes in follow PR.

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Aug 12, 2020
@ghost ghost added the Review - Needed The PR is being reviewed label Aug 20, 2020
@ghost

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@daxian-dbw Dongbo Wang (daxian-dbw) added the CommunityDay-Small A small PR that the PS team has identified to prioritize to review label May 15, 2023
@ghost ghost removed the Review - Needed The PR is being reviewed label May 22, 2023

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.

I resolved the other requested changes as I don't think they're necessary and looked helpful for getting the tests to run again. However, spotted one real bug at the end that needs fixing (the test is no longer validating the correct function).

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label May 22, 2023
@pull-request-quantifier-deprecated

Copy link
Copy Markdown

This PR has 142 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Medium
Size       : +66 -76
Percentile : 48.4%

Total files changed: 1

Change summary by file extension:
.ps1 : +66 -76

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@yecril71pl

Copy link
Copy Markdown
Contributor Author

Wow, long time no see 😄 Is there anything you want me to do about this? I sincerely hope it will move forward without me 😉

@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label May 22, 2023

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's all good Christopher Yeleighton (@yecril71pl)! CI passed with my bug-fix, approving. Thanks for your contribution!

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit b69cae0 into PowerShell:master May 22, 2023
@ghost

Copy link
Copy Markdown

🎉v7.4.0-preview.4 has been released which incorporates this pull request.:tada:

Handy links:

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Test Indicates that a PR should be marked as a test change in the Change Log CommunityDay-Small A small PR that the PS team has identified to prioritize to review Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants