Title: Make xUnit test run sequentially to rule out race conditions around 'powershell.config.json' by daxian-dbw · Pull Request #8945 · PowerShell/PowerShell · GitHub
Open Graph Title: Make xUnit test run sequentially to rule out race conditions around 'powershell.config.json' by daxian-dbw · Pull Request #8945 · PowerShell/PowerShell
X Title: Make xUnit test run sequentially to rule out race conditions around 'powershell.config.json' by daxian-dbw · Pull Request #8945 · PowerShell/PowerShell
Description: PR Summary Make xUnit test truly run sequentially to rule out race conditions around powershell.config.json. Fix #8784 #8715 PR Context We keep getting xUnit test failures due to the race condition around manipulating powershell.config.json file, even though we have been trying to run xUnit tests sequentially by having dotnet test -p:ParallelizeTestCollections=false. It turns out -p:ParallelizeTestCollections=false doesn't work, and we have to use xunit.runner.json to disable parallel running. Failure example: https://powershell.visualstudio.com/PowerShell/_build/results?buildId=13830 From the exception below, we can see the all-user scope config file was there when we check for file existence in ReadValueFromFile, but was deleted when we came to creating a FileStream out of it. This is because the all-user scope config file as created and deleted as part of the PSConfiguration tests. This is an evidence that tests are still running in parallel with dotnet test -p:ParallelizeTestCollections=false. [xUnit.net 00:00:03.20] PSTests.Sequential.RunspaceTests.TestRunspaceWithPowerShellAndInitialSessionState [FAIL] Failed PSTests.Sequential.RunspaceTests.TestRunspaceWithPowerShellAndInitialSessionState Error Message: System.IO.FileNotFoundException : Could not find file 'C:\Users\VssAdministrator\Documents\PowerShell\powershell.config.json'. Stack Trace: at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.Management.Automation.Configuration.PowerShellConfig.WaitForFile(String fullPath, FileMode mode, FileAccess access, FileShare share) in D:\a\1\s\src\System.Management.Automation\engine\PSConfiguration.cs:line 426 at System.Management.Automation.Configuration.PowerShellConfig.ReadValueFromFile[T](ConfigScope scope, String key, T defaultValue, Func`4 readImpl) in D:\a\1\s\src\System.Management.Automation\engine\PSConfiguration.cs:line 397 at System.Management.Automation.Utils.GetPolicySettingFromConfigFile[T](ConfigScope[] preferenceOrder) in D:\a\1\s\src\System.Management.Automation\engine\Utils.cs:line 523 at System.Management.Automation.Utils.GetPolicySetting[T](ConfigScope[] preferenceOrder) in D:\a\1\s\src\System.Management.Automation\engine\Utils.cs:line 509 at Microsoft.PowerShell.Commands.ModuleCmdletBase.GetModuleLoggingInformation(IEnumerable`1& moduleNames) in D:\a\1\s\src\System.Management.Automation\engine\Modules\ModuleCmdletBase.cs:line 4507 at System.Management.Automation.PSSnapInReader.ReadEnginePSSnapIns() in D:\a\1\s\src\System.Management.Automation\singleshell\config\MshSnapinInfo.cs:line 1068 at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault() in D:\a\1\s\src\System.Management.Automation\engine\InitialSessionState.cs:line 1526 at PSTests.Sequential.RunspaceTests.TestRunspaceWithPowerShellAndInitialSessionState() in D:\a\1\s\test\xUnit\csharp\test_Runspace.cs:line 72 Results File: D:\a\1\s\ParallelXUnitTestResults.xml PR Checklist PR has a meaningful title Use the present tense and imperative mood when describing your changes Summarized changes Change is not breaking Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header This PR is ready to merge and is not Work in Progress. If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready. User-facing changes Not Applicable OR Documentation needed Issue filed: Testing - New and feature N/A or can only be tested interactively OR Make sure you've added a new test if existing tests do not effectively test the code changed Add [feature] to your commit messages if the change is significant or affects feature tests
Open Graph Description: PR Summary Make xUnit test truly run sequentially to rule out race conditions around powershell.config.json. Fix #8784 #8715 PR Context We keep getting xUnit test failures due to the race condition...
X Description: PR Summary Make xUnit test truly run sequentially to rule out race conditions around powershell.config.json. Fix #8784 #8715 PR Context We keep getting xUnit test failures due to the race condition...
Opengraph URL: https://github.com/PowerShell/PowerShell/pull/8945
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:796e5054-accb-042b-054c-57166553fd90 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C6A6:241052:1C6B474:2640512:6A59867B |
| html-safe-nonce | 6c4472ed5873b5225f0a91afa47755fce902b175d7a73a16b21a53e7fdaeb083 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkE2OjI0MTA1MjoxQzZCNDc0OjI2NDA1MTI6NkE1OTg2N0IiLCJ2aXNpdG9yX2lkIjoiOTE5MTM5Mjc2MDEyNTAzMjA1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c7e5c52c991ad741a9cdf416a414e8116a1d664f4956ce6fa9cf7a8477e43a7f |
| hovercard-subject-tag | pull_request:255158478 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/PowerShell/PowerShell/pull/8945/files |
| twitter:image | https://avatars.githubusercontent.com/u/127450?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/127450?s=400&v=4 |
| og:image:alt | PR Summary Make xUnit test truly run sequentially to rule out race conditions around powershell.config.json. Fix #8784 #8715 PR Context We keep getting xUnit test failures due to the race condition... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a540949572872b935b393b36db38922db390ae71c859537d741b8f3eb7e545b5 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 624bb50a7497aa346bef8cc3743af408a9ea10ca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width