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 false errors and broken CI-logs from P-tests #2345

Merged

Conversation

fflaten
Copy link
Collaborator

@fflaten fflaten commented May 10, 2023

PR Summary

After switching to -EncodedCommand for child powershell/pwsh processes in P-tests (#2267) we get CliXML-output in CI logs and false errors in CI-report.

Using -EncodedCommand changes default output to XML in non-interactive environments with redirected output like our AzDO Pipelines CI. The normal workaround of explicitly setting -OutputFormat Text is not honored prior to PS 6.2 (incl. 5.1).

This PR reverts to using -Command with different commands to handle the changed argument-behavior in PS 7.3+. It also extracts the helper to a PTestHelpers module to reduce duplicated code.

Fix #2340

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required)
  • Documentation is updated/added (if required)

@fflaten
Copy link
Collaborator Author

fflaten commented May 13, 2023

Workaround solved PS6+ but not 5.1 for some reason. 😕
Worst of all - can't repro locally in PS5.1

@fflaten
Copy link
Collaborator Author

fflaten commented May 13, 2023

Looks like the logic was changed in PS6+ to respect explicit outputformat (PowerShell/PowerShell#8115), so 5.1 has this logic.

https://github.com/PowerShell/PowerShell/blob/2f818615bed15141c062dd185f659ed110d9c6ba/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs#L1261-L1267

AzDO likely redirects errors unlike my local repro attempts

Also extracts function to PTestHelpers utility-module
to deduplicate code
@fflaten
Copy link
Collaborator Author

fflaten commented May 13, 2023

No solution for PS 5.1 AFAIK, so will revert to -Command.

@fflaten fflaten changed the title Fix CliXML output from P-tests in CI Fix false errors and broken CI-logs from P-tests May 13, 2023
@fflaten fflaten marked this pull request as ready for review May 13, 2023 12:09
@nohwnd nohwnd merged commit 89a3f8e into pester:main Jun 7, 2023
@fflaten fflaten deleted the 2340-azdo-pipeline-reports-errors-and-noise branch June 7, 2023 16:28
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.

AzDO pipeline reports errors and noise
2 participants