Issue with report with Linux file paths when updating from 23.7.1 to 23.7.2
Hello,
Updating from 23.7.1 to 23.7.2 is breaking my CI. I'm building my application on a Windows machine and executing the tests on a Linux one.
In the CI log we can see:
VerifyException : Directory: D:\b\0\2091\Source\Macros\Tests\Source\Scripting/D:\b\0\2091\Source\Macros\Tests\Source\Scripting
New:
- Received: D:\b\0\2091\Source\Macros\Tests\Source\Scripting/D:\b\0\2091\Source\Macros\Tests\Source\Scripting/Test_Generate_Project_Is_Deterministic.net60.LINUX.DotNet6_0.received.txt
Verified: D:\b\0\2091\Source\Macros\Tests\Source\Scripting/D:\b\0\2091\Source\Macros\Tests\Source\Scripting/Test_Generate_Project_Is_Deterministic.net60.LINUX.verified.txt
When looking closely we can see that the path is concatenated twice:
D:\b\0\2091\Source\Macros\Tests\Source\Scripting/D:\b\0\2091\Source\Macros\Tests\Source\Scripting/
The settings are set like that:
private VerifySettings GetVerifySettings([CallerMemberName] string methodName = null)
{
var settings = new VerifySettings();
settings.DisableRequireUniquePrefix();
string fileName;
#if NET472
fileName = $"{methodName}.net472";
#else
fileName = $"{methodName}.net60";
#endif
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
fileName += ".OSX";
else if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
fileName += ".LINUX";
settings.UseFileName(fileName);
return settings;
}
I quickly looked at the diff and I can see some changes regarding path concatenation that might explain the regression.
(the issue is also present with version 24.1.0)
can u share a repro
bump
Hi @SimonCropp, the original repository is on an internal GitLab instance. As it also relies on specific build infrastructure I don't really see how can I share something meaningful.
Also, I don't think there's anything special about my test except that it's being built on Windows and the test ran on another Linux machine.
I'll try to reproduce it with a sample and WSL.
Here you go: TestVerify.zip
To repro:
- Run on Windows:
dotnet test - Then execute on Linux (through WSL):
wsl dotnet test --no-build
I get the output:
Test run for /mnt/c/Users/jrichard/RiderProjects/TestVerify/TestVerify/bin/Debug/net8.0/TestVerify.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Failed CrossPlatformTest [1 s]
Error Message:
VerifyException : Directory: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify
NotEqual:
- Received: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/CrossPlatformTest.net60.LINUX.received.txt
Verified: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/CrossPlatformTest.net60.LINUX.verified.txt
FileContent:
NotEqual:
Received: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/CrossPlatformTest.net60.LINUX.received.txt
test
Verified: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/CrossPlatformTest.net60.LINUX.verified.txt
Stack Trace:
Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: 1 s - TestVerify.dll (net8.0)
i am having rouble finding the time to dedicate to this. do you want to have a go at submitting a PR that fixes it?
Sure @SimonCropp I can take a look.