microsoft / vstest

Visual Studio Test Platform is the runner and engine that powers test explorer and vstest.console.
MIT License
870 stars 316 forks source link

VS2022 Preview (17.11.0 Preview 2.0): Exception: "Support for Windows containers in Docker is not enabled." when trying to access windows container #5106

Open bevanweiss opened 1 week ago

bevanweiss commented 1 week ago

Description

I've got a solution with an xUnit Test project within it. I've configured a testenvironments.json file as below

{
    "version": "1",
    "environments": [
        {
            "name": "Windows ltsc2022",
            "type": "docker",
            "dockerFile": "../../../testdocker/Dockerfile"
        }
    ]
}

and then I have a Dockerfile that is incredibly naive... but should be ok for now (it's to test MSI packages, so nothing beyond base OS is required)

# Use the latest Windows Server Core 2022 image.
FROM mcr.microsoft.com/windows/servercore:ltsc2022

Steps to reproduce

When I open the Test Explorer, all looks good, and I can see the remote container in the drop down list. image

However when I select the remote container, it generates an exception telling me that support for Windows containers in Docker is not enabled.. image

However if I go to a command line, I can run that Docker file without a problem image

Expected behavior

I expect the Visual Studio Test Runner to launch the (Windows) docker container, and to connect to it. Which would then allow for the Test Suite to be run from inside the container.

Actual behavior

Docker container is not started. Misleading diagnostic message "Connected to test environment..." is displayed. Exception and stack trace is reported, again with misleading information suggesting the problem is the Docker application setup.

Diagnostic logs

Connected to test environment 'Windows ltsc2022' System.Exception: Support for Windows containers in Docker is not enabled. at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProviders.DockerTestPlatformProvider.d17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformAgentPool.<>cDisplayClass24_0.<b0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Utilities.EventPumpExtensions.<>cDisplayClass4_01.<<EnqueueAsync>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Extensibility.TaskCompletionSourceExtensions.<RunTaskWithCatchAsync>d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.d13`1.MoveNext() System.Exception: Support for Windows containers in Docker is not enabled. at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProviders.DockerTestPlatformProvider.d17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformAgentPool.<>cDisplayClass24_0.<b0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Utilities.EventPumpExtensions.<>cDisplayClass4_0`1.<b1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Extensibility.TaskCompletionSourceExtensions.d1`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.d131.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<UpdateRuntimeEnvironmentsAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.<CallWithCatchAsync>d__141.MoveNext()

Environment

Windows 11 22H2 (OS Build 22621.3737) VSTest version 17.11.0-preview-24263-02 (x64) Docker Desktop 4.31.1 (153621)

nohwnd commented 1 week ago

@peterwald please have a look, this seems specific to TE and the functionality you worked on.

peterwald commented 1 week ago

We don't currently enable support for remote testing in Windows containers in Docker, only Linux containers.

There are quite a few technical differences that make it difficult to maintain and we have been seeking feedback from our users as to whether it would be worthwhile to invest in.

/cc @AbhitejJohn

bevanweiss commented 1 week ago

@peterwald Is there any estimate for when Test runs in Windows (amd64 on amd64) Containers would be available for early testing? It'd be nice if rather than crashing out with an Exception, it provided a large warning text (both top and bottom of the console sequence).. but then did attempt to do stuff (at least launching the container would have been expected).

My particular test case is MSI deployments, where there are .NET 'tests' which validate certain aspects of the MSI deployments within the container (so that restoring to reproducible state is trivial).