-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
Use real path to temp path on macOS and GetTempPath() otherwise when constructing TestDrive #1294
Conversation
otherwise, use GetTempPath() so that on Windows it returns the long path
I'll fix the test failures tomorrow |
Tests use Pester/Functions/Environment.Tests.ps1 Line 98 in 600abd2
that doesn't change [io.path]::GetTempPath()
|
Interesting, I thought the code was using the |
@SteveL-MSFT Do we ready jump to latest Pester version in PowerShell Core repo? I ask because perhaps we need servicing fix for version we use. Perhaps it is not good change Pester version and move to .Net Core 3.0 in the same time. |
@iSazonov unless there's a bunch of test failures with latest Pester, I don't see a reason not to move to latest stable version of Pester |
In the case we should make this in PowerShell master branch before we move to .Net Core 3.0. |
@iSazonov we need to wait for a release first, but yes, we can take it in master branch |
If you don't fix the name I will fix it and release on Saturday/Sunday. |
@nohwnd I believe your comment has been addressed |
special case macOS to use /private/tmp which is the real folder path
otherwise, use GetTempPath() so that on Windows it returns the long path
1. General summary of the pull request
On macOS, the
/tmp
path is a symlink to/private/tmp
, this causes problems in tests that create a test file and later tries to validate the path:This fails as $testPath will be something like:
/tmp/foo
but the real file path returned from some cmdlet or .NET API will be/private/tmp/foo
.On Windows, the problem is that
$env:TEMP
which is used to construct the TestDrive path uses the 8.1 path syntax. So on AzDevOps, the user is calledVSSADMINISTRATOR
so$env:TEMP
isC:\Users\VSSADM~1\AppData\Local\Temp\
but similar to macOS where a test validates the paths, it will fail because a cmdlet or .NET API will often return the longpathC:\Users\VSSADMINISTRATOR\AppData\Local\Temp\
.On Linux,
GetTempPath()
simply returns/tmp/
which is correct.