up tests and theme
This commit is contained in:
@@ -56,11 +56,16 @@ public sealed class PostgreSqlFixture : IAsyncLifetime
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
// On Windows, try to open the Docker named pipe with a short timeout.
|
||||
// File.Exists does not work for named pipes.
|
||||
using var pipe = new System.IO.Pipes.NamedPipeClientStream(".", "docker_engine", System.IO.Pipes.PipeDirection.InOut, System.IO.Pipes.PipeOptions.None);
|
||||
pipe.Connect(2000); // 2 second timeout
|
||||
return true;
|
||||
// Check if the Docker daemon is actually running by looking for its process.
|
||||
// NamedPipeClientStream.Connect() hangs indefinitely when Docker Desktop is
|
||||
// installed but not running (the pipe exists but nobody reads from it).
|
||||
// Testcontainers' own Docker client also hangs in this scenario.
|
||||
// Checking for a running process is instant and avoids the hang entirely.
|
||||
var dockerProcesses = System.Diagnostics.Process.GetProcessesByName("com.docker.backend");
|
||||
if (dockerProcesses.Length == 0)
|
||||
dockerProcesses = System.Diagnostics.Process.GetProcessesByName("dockerd");
|
||||
foreach (var p in dockerProcesses) p.Dispose();
|
||||
return dockerProcesses.Length > 0;
|
||||
}
|
||||
|
||||
// On Linux/macOS, check for the Docker socket
|
||||
|
||||
Reference in New Issue
Block a user