Skip to content

Commit f49e6d8

Browse files
committed
feat: Add Docker Engine v29 support
1 parent 8a7b97e commit f49e6d8

File tree

12 files changed

+40
-22
lines changed

12 files changed

+40
-22
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"ghcr.io/devcontainers/features/docker-in-docker:2": {
1414
"moby": true
1515
},
16-
"ghcr.io/devcontainers/features/dotnet:2.4.0": {
17-
"version": "9.0",
16+
"ghcr.io/devcontainers/features/dotnet:2.4.1": {
17+
"version": "10.0",
1818
"installUsingApt": false
1919
}
2020
},

.github/workflows/test-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
pattern: Testcontainers*
3131

3232
- name: Publish Test Report
33-
uses: dorny/test-reporter@v2.1.1
33+
uses: dorny/test-reporter@v2.3.0
3434
with:
3535
name: test-report
3636
path: '**/*.trx'

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2"/>
8-
<PackageVersion Include="Docker.DotNet.Enhanced.X509" Version="3.130.0"/>
9-
<PackageVersion Include="Docker.DotNet.Enhanced" Version="3.130.0"/>
8+
<PackageVersion Include="Docker.DotNet.Enhanced.X509" Version="3.131.1"/>
9+
<PackageVersion Include="Docker.DotNet.Enhanced" Version="3.131.1"/>
1010
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0"/>
1111
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1"/>
1212
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3"/>

build/Tasks.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public void DotNetTest(SolutionProject project)
1616
Filter = Parameters.TestFilter,
1717
ResultsDirectory = Parameters.Paths.Directories.TestResultsDirectoryPath,
1818
ArgumentCustomization = args => args
19-
.AppendSwitchQuoted("--blame-hang-timeout", "5m"),
19+
// The windows-2025 GH-hosted runner no longer has cached images. Pulling the
20+
// servercore:ltsc2025 image takes significantly longer.
21+
.AppendSwitchQuoted("--blame-hang-timeout", "10m"),
2022
});
2123
}
2224
}

src/Testcontainers/Clients/ContainerConfigurationConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public ToNetworks(IContainerConfiguration configuration)
9797

9898
public override IEnumerable<KeyValuePair<string, EndpointSettings>> Convert([CanBeNull] IEnumerable<INetwork> source)
9999
{
100-
return source?.Select(network => new KeyValuePair<string, EndpointSettings>(network.Name, new EndpointSettings { Aliases = _configuration.NetworkAliases?.ToList() }));
100+
var endpointSettings = new EndpointSettings { Aliases = _configuration.NetworkAliases?.ToList(), MacAddress = _configuration.MacAddress };
101+
return source?.Select(network => new KeyValuePair<string, EndpointSettings>(network.Name, endpointSettings));
101102
}
102103
}
103104

src/Testcontainers/Clients/DockerContainerOperations.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ public async Task<string> RunAsync(IContainerConfiguration configuration, Cancel
204204
Image = configuration.Image.FullName,
205205
Name = configuration.Name,
206206
Hostname = configuration.Hostname,
207-
MacAddress = configuration.MacAddress,
208207
WorkingDir = configuration.WorkingDirectory,
209208
Entrypoint = converter.Entrypoint,
210209
Cmd = converter.Command,
Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace DotNet.Testcontainers.Clients
22
{
33
using System;
4+
using System.Text.Json;
45
using Docker.DotNet.Models;
56
using Microsoft.Extensions.Logging;
67

@@ -15,29 +16,40 @@ public TraceProgress(ILogger logger)
1516

1617
public void Report(JSONMessage value)
1718
{
18-
#pragma warning disable CA1848, CA2254
19+
if (value.Error != null)
20+
{
21+
_logger.LogError("ID={ID}: {Error}", value.ID, value.Error.Message);
22+
return;
23+
}
1924

20-
if (!string.IsNullOrWhiteSpace(value.Status))
25+
if (!_logger.IsEnabled(LogLevel.Debug))
2126
{
22-
_logger.LogDebug(value.Status.TrimEnd());
27+
return;
2328
}
2429

2530
if (!string.IsNullOrWhiteSpace(value.Stream))
2631
{
27-
_logger.LogDebug(value.Stream.TrimEnd());
32+
_logger.LogDebug("{Stream}", value.Stream.Trim());
33+
return;
2834
}
2935

30-
if (!string.IsNullOrWhiteSpace(value.ProgressMessage))
36+
if (value.Progress != null && value.Progress.Total > 0)
3137
{
32-
_logger.LogDebug(value.ProgressMessage.TrimEnd());
38+
var percentage = (double)value.Progress.Current / value.Progress.Total * 100;
39+
_logger.LogDebug("ID={ID}: {Status} {Percentage,6:F2}% ({Current}/{Total})", value.ID, value.Status, percentage, value.Progress.Current, value.Progress.Total);
40+
return;
3341
}
3442

35-
if (!string.IsNullOrWhiteSpace(value.ErrorMessage))
43+
if (!string.IsNullOrWhiteSpace(value.Status))
3644
{
37-
_logger.LogError(value.ErrorMessage.TrimEnd());
45+
_logger.LogDebug("ID={ID}: {Status}", value.ID, value.Status);
46+
return;
3847
}
3948

40-
#pragma warning restore CA1848, CA2254
49+
if (value.Aux != null)
50+
{
51+
_logger.LogDebug("Auxiliary data: {ExtensionData}", JsonSerializer.Serialize(value.Aux.ExtensionData));
52+
}
4153
}
4254
}
4355
}

src/Testcontainers/Configurations/AuthConfigs/DockerEndpointAuthenticationConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace DotNet.Testcontainers.Configurations
2020
// class or stop exposing the `TestcontainersSettings` properties publicly.
2121
// Instead, we could rely only on custom configurations via environment variables
2222
// or the properties file.
23-
private static readonly TimeSpan NamedPipeConnectionTimeout = EnvironmentConfiguration.Instance.GetNamedPipeConnectionTimeout() ?? PropertiesFileConfiguration.Instance.GetNamedPipeConnectionTimeout() ?? TimeSpan.FromSeconds(1);
23+
private static readonly TimeSpan NamedPipeConnectionTimeout = EnvironmentConfiguration.Instance.GetNamedPipeConnectionTimeout() ?? PropertiesFileConfiguration.Instance.GetNamedPipeConnectionTimeout() ?? TimeSpan.FromSeconds(5);
2424

2525
/// <summary>
2626
/// Initializes a new instance of the <see cref="DockerEndpointAuthenticationConfiguration" /> struct.

src/Testcontainers/Containers/ExecResult.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public readonly struct ExecResult
1414
/// <param name="stdout">The stdout output.</param>
1515
/// <param name="stderr">The stderr output.</param>
1616
/// <param name="exitCode">The exit code.</param>
17-
public ExecResult(string stdout, string stderr, long exitCode)
17+
public ExecResult(string stdout, string stderr, long? exitCode)
1818
{
1919
Stdout = stdout;
2020
Stderr = stderr;
@@ -37,6 +37,6 @@ public ExecResult(string stdout, string stderr, long exitCode)
3737
/// Gets the exit code.
3838
/// </summary>
3939
[PublicAPI]
40-
public long ExitCode { get; }
40+
public long? ExitCode { get; }
4141
}
4242
}

tests/Testcontainers.Commons/CommonImages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ public static class CommonImages
1515

1616
public static readonly IImage Nginx = new DockerImage("nginx:1.22");
1717

18-
public static readonly IImage ServerCore = new DockerImage("mcr.microsoft.com/windows/servercore:ltsc2022");
18+
public static readonly IImage ServerCore = new DockerImage("mcr.microsoft.com/windows/servercore:ltsc2025");
1919
}

0 commit comments

Comments
 (0)