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

running dotnet test --logger:trx with docker does not always produce trx file #646

Closed
schwamster opened this issue Mar 22, 2017 · 4 comments
Assignees

Comments

@schwamster
Copy link

Description

running dotnet test --logger:trx in a docker image where the respective folder is mounted (Win 7 Docker Toolbox) will not produce a trx file since the produced filename is not valid on windows.

Steps to reproduce

Win7 Docker Toolbox

docker run -it --rm  -v //c/Users/myuser/myapp:/app microsoft/aspnetcore-build:latest
cd /app
dotnet new xunit
dotnet restore
dotnet test --logger:trx

The reason for this can be observed running the following sequence:

docker run -it --rm  -v //c/Users/myuser/myapp:/app microsoft/aspnetcore-build:latest
mkdir /app-test && cd /app-test
dotnet new xunit
dotnet restore
dotnet test --logger:trx
cp -R TestResults /app/

Now you can see that the trx file is created (since its done outside of the mounted volume) but you cant copy it - protocol error
capture

Expected behavior

  • runnig dotnet test --logger:trx should work when running within docker in a mounted folder from Win7
  • resulting trx file should have the same filename format as on windows

Actual behavior

  • trx file is not produced since the produced filename is not valid on windows
  • filenames for trx reports have a different format on windows and linux

Environment

Win 7,
Docker Toolbox

Other

See also original Issue: aspnet/aspnet-docker#211

@harshjain2
Copy link
Contributor

@schwamster You can provide custom filename for trx logger file.

dotnet test --logger "trx;LogFileName=abc.trx"

Will this solve your issue?

@schwamster
Copy link
Author

schwamster commented Mar 27, 2017

@harshjain2 valid workaround. still would be nice if it worked the same way ( plus compatible) not matter what operating system.

@harshjain2
Copy link
Contributor

@schwamster Thanks for the feedback.

This issue seems to be specific to Win7 only.
I tried the below command by installing docker in Win10, it is working.

docker run -it --rm -v //c/Users/myuser/myapp:/app microsoft/aspnetcore-build:latest
mkdir /app-test && cd /app-test
dotnet new xunit
dotnet restore
dotnet test --logger:trx
cp -R TestResults /app/

@schwamster
Copy link
Author

schwamster commented Mar 28, 2017

@harshjain2 you are more or less right. The bigger problem i described above only applies to windows 7 + docker toolbox. It does work on win 10 with docker for windows - but if you look closely it also is a bit hacky. The colons get replaced by some other strange character. I suppose this is either windows or docker for windows compensating. So on win 10 it will be able to produce the report but it will still have inconsistent names ->

example of reportfilename produced on linux mounted on win 10:

e8787d44-0e31-11e7-821b-e66ddb901e0e

while the file would look something like that on linux:
lintrx

and if you produce the report directly on windows you will end up with a file name like this:
wintrx

So to sum up, yes there is a workaround and it kind of works on win 10 but its not pretty :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants