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

dotnet test --no-build isn't running tests on built source mounted to a docker container #10755

Open
david-gonzalez-pnw opened this issue Mar 3, 2020 · 0 comments

Comments

@david-gonzalez-pnw
Copy link

david-gonzalez-pnw commented Mar 3, 2020

Steps to reproduce

  1. Build your .net core source code, I used https://github.com/dotnet/samples/tree/master/core/getting-started/unit-testing-using-nunit in the below example and saved it in c:/source/unit-testing-using-nunit

  2. Create a container using something similar to the below. Basically the pre-req is dotnet core. In our case we needed both framework and core to build our projects.

    FROM mcr.microsoft.com/dotnet/framework/sdk:4.8
    SHELL ["powershell.exe", "$ErrorActionPreference = 'Stop';$ProgressPreference='SilentlyContinue';"]    
    RUN New-Item -Type Directory -Name "tools"; `
    Push-Location tools; `
    Invoke-WebRequest -OutFile dotnet-install.ps1 -UseBasicParsing "https://dot.net/v1/dotnet-install.ps1"; `
        .\dotnet-install.ps1 -Channel 3.1; `
        Pop-Location;
    
    ENTRYPOINT powershell.exe
    
  3. Start the container and bind mount a volume with your built source code

    docker run -it `
      --name dotnettest `
      --mount type=bind,source=C:/source/unit-testing-using-nunit,target=C:/source/unit-testing-using-nunit `
      dotnettestissue:latest
    
  4. Run cd /source/unit-testing-using-nunit and dotnet test --no-build in the root test folder

    DotNetTest

    Built DLLs in Docker Container

    image

Expected behavior

The tests run without a restore or build beforehand.

Actual behavior

dotnet test exits out immediately

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json):
Version: 3.1.101
Commit: b377529

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\

Host (useful for support):
Version: 3.1.1
Commit: a1388f194c

.NET Core SDKs installed:
3.1.101 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

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

No branches or pull requests

1 participant