Skip to content

Commit 26dbdcc

Browse files
authored
chore: Bump Docker.DotNet version to 3.128.1 (#1443)
1 parent 4fea180 commit 26dbdcc

File tree

9 files changed

+22
-18
lines changed

9 files changed

+22
-18
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.1.3": {
17-
"version": "8.0",
16+
"ghcr.io/devcontainers/features/dotnet:2.2.2": {
17+
"version": "9.0",
1818
"installUsingApt": false
1919
}
2020
},

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.5.1"/>
8-
<PackageVersion Include="Docker.DotNet.Enhanced.X509" Version="3.126.1"/>
9-
<PackageVersion Include="Docker.DotNet.Enhanced" Version="3.126.1"/>
8+
<PackageVersion Include="Docker.DotNet.Enhanced.X509" Version="3.128.1"/>
9+
<PackageVersion Include="Docker.DotNet.Enhanced" Version="3.128.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"/>
@@ -26,7 +26,7 @@
2626
<PackageVersion Include="xunit.extensibility.execution" Version="2.9.3"/>
2727
<PackageVersion Include="xunit.v3.extensibility.core" Version="1.1.0"/>
2828
<!-- Third-party client dependencies to connect and interact with the containers: -->
29-
<PackageVersion Include="Apache.NMS.ActiveMQ" Version="2.1.0"/>
29+
<PackageVersion Include="Apache.NMS.ActiveMQ" Version="2.1.1"/>
3030
<PackageVersion Include="ArangoDBNetStandard" Version="2.0.1"/>
3131
<PackageVersion Include="AWSSDK.CloudWatchLogs" Version="3.7.104.14"/>
3232
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="3.7.101.42"/>

docs/test_frameworks/xunit_net.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ be115f3df138 redis:7.0 "docker-entrypoint.s…" 3 seconds
4949

5050
## Creating a shared test context
5151

52-
Sometimes, creating and disposing of a test resource can be an expensive operation that you do not want to repeat for every test. By inheriting from the `ContainerFixture<TBuilderEntity, TContainerEntity>` class, you can share the test resource instance across all tests within the same test class, or even within the assembly, if you use xUnit.net V3 or a compatible V2 extension like [the one from the examples-repo](https://github.com/xunit/samples.xunit/tree/main/v2/AssemblyFixtureExample).
52+
Sometimes, creating and disposing of a test resource can be an expensive operation that you do not want to repeat for every test. By inheriting from the `ContainerFixture<TBuilderEntity, TContainerEntity>` class, you can share the test resource instance across all tests within the same test class, or even within the assembly, if you use xUnit.net v3 or a compatible v2 extension like the one from the [AssemblyFixtureExample](https://github.com/xunit/samples.xunit/tree/main/v2/AssemblyFixtureExample) repository.
5353

5454
xUnit.net's fixture implementation does not rely on the `ITestOutputHelper` interface to capture and forward log messages; instead, it expects an implementation of `IMessageSink`. Make sure your fixture's default constructor accepts the interface implementation and forwards it to the base class.
5555

@@ -81,7 +81,7 @@ d29a393816ce redis:7.0 "docker-entrypoint.s…" 3 seconds
8181
e878f0b8f4bc testcontainers/ryuk:0.9.0 "/bin/ryuk" 3 seconds ago
8282
```
8383

84-
To use a single container-fixture across all tests of a test-assembly (using xUnit.net V3 or an extension), add the `[assembly: AssemblyFixture(typeof(TContainerFixtureEntity))]` annotation referring to your subclass to the assembly. The fixture can then be injected into test class constructors (as shown above), or accessed using the `TestContext.Current.GetFixture<TContainerFixtureEntity>()` method (v3 only) in any test.
84+
To use a single container fixture across all tests of a test-assembly (using xUnit.net v3 or an extension), add the `[assembly: AssemblyFixture(typeof(TContainerFixtureEntity))]` annotation referring to your subclass to the assembly. The fixture can then be injected into test class constructors (as shown above), or accessed using the `TestContext.Current.GetFixture<TContainerFixtureEntity>()` method (v3 only) in any test.
8585

8686
## Testing ADO.NET services
8787

src/Testcontainers/Builders/TlsCredentials.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public override bool IsTlsCredentials()
1616
return true;
1717
}
1818

19-
public override HttpMessageHandler GetHandler(HttpMessageHandler innerHandler)
19+
public override HttpMessageHandler GetHandler(HttpMessageHandler handler)
2020
{
21-
var handler = (ManagedHandler)innerHandler;
22-
handler.ServerCertificateValidationCallback = ServerCertificateValidationCallback;
23-
return handler;
21+
var managedHandler = (ManagedHandler)handler;
22+
managedHandler.ServerCertificateValidationCallback = ServerCertificateValidationCallback;
23+
return managedHandler;
2424
}
2525
}
2626
}

src/Testcontainers/Clients/ContainerConfigurationConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ namespace DotNet.Testcontainers.Clients
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
6-
using System.Net;
76
using Docker.DotNet.Models;
87
using DotNet.Testcontainers.Configurations;
98
using DotNet.Testcontainers.Networks;

src/Testcontainers/Clients/DockerContainerOperations.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public async Task<long> GetExitCodeAsync(string id, CancellationToken ct = defau
7171
Timestamps = timestampsEnabled,
7272
};
7373

74-
using (var stdOutAndErrStream = await DockerClient.Containers.GetContainerLogsAsync(id, false, logsParameters, ct)
74+
using (var stdOutAndErrStream = await DockerClient.Containers.GetContainerLogsAsync(id, logsParameters, ct)
7575
.ConfigureAwait(false))
7676
{
7777
return await stdOutAndErrStream.ReadOutputToEndAsync(ct)
@@ -119,7 +119,7 @@ public async Task<Stream> GetArchiveFromContainerAsync(string id, string path, C
119119
{
120120
Logger.ReadArchiveFromDockerContainer(id, path);
121121

122-
var tarResponse = await DockerClient.Containers.GetArchiveFromContainerAsync(id, new GetArchiveFromContainerParameters { Path = path }, false, ct)
122+
var tarResponse = await DockerClient.Containers.GetArchiveFromContainerAsync(id, new ContainerPathStatParameters { Path = path }, false, ct)
123123
.ConfigureAwait(false);
124124

125125
return tarResponse.Stream;
@@ -141,7 +141,7 @@ public async Task AttachAsync(string id, IOutputConsumer outputConsumer, Cancell
141141
Stream = true,
142142
};
143143

144-
var stream = await DockerClient.Containers.AttachContainerAsync(id, false, attachParameters, ct)
144+
var stream = await DockerClient.Containers.AttachContainerAsync(id, attachParameters, ct)
145145
.ConfigureAwait(false);
146146

147147
_ = stream.CopyOutputToAsync(Stream.Null, outputConsumer.Stdout, outputConsumer.Stderr, ct)
@@ -159,10 +159,10 @@ public async Task<ExecResult> ExecAsync(string id, IList<string> command, Cancel
159159
AttachStderr = true,
160160
};
161161

162-
var execCreateResponse = await DockerClient.Exec.ExecCreateContainerAsync(id, execCreateParameters, ct)
162+
var execCreateResponse = await DockerClient.Exec.CreateContainerExecAsync(id, execCreateParameters, ct)
163163
.ConfigureAwait(false);
164164

165-
using (var stdOutAndErrStream = await DockerClient.Exec.StartAndAttachContainerExecAsync(execCreateResponse.ID, false, ct)
165+
using (var stdOutAndErrStream = await DockerClient.Exec.StartContainerExecAsync(execCreateResponse.ID, new ContainerExecStartParameters(), ct)
166166
.ConfigureAwait(false))
167167
{
168168
var (stdout, stderr) = await stdOutAndErrStream.ReadOutputToEndAsync(ct)

src/Testcontainers/Configurations/WaitStrategies/UntilMessageIsLogged.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public UntilMessageIsLogged(Regex pattern)
2222
public async Task<bool> UntilAsync(IContainer container)
2323
{
2424
var maxTime = container.StoppedTime > container.CreatedTime ? container.StoppedTime : container.CreatedTime;
25+
2526
var (stdout, stderr) = await container.GetLogsAsync(since: maxTime, timestampsEnabled: false)
2627
.ConfigureAwait(false);
2728

tests/Testcontainers.Pulsar.Tests/PulsarContainerTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public async Task ConsumerReceivesSendMessage()
5555
.Create();
5656

5757
// When
58+
_ = await consumer.OnStateChangeTo(ConsumerState.Active, TimeSpan.FromSeconds(10))
59+
.ConfigureAwait(true);
60+
5861
_ = await producer.Send(helloPulsar)
5962
.ConfigureAwait(true);
6063

tests/Testcontainers.Xunit.Tests/PostgreSqlContainer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ protected override PostgreSqlBuilder Configure(PostgreSqlBuilder builder)
1616
public sealed partial class PostgreSqlContainerTest
1717
{
1818
// # --8<-- [start:ConfigureDbProviderFactory]
19-
public override DbProviderFactory DbProviderFactory => NpgsqlFactory.Instance;
19+
public override DbProviderFactory DbProviderFactory
20+
=> NpgsqlFactory.Instance;
2021
// # --8<-- [end:ConfigureDbProviderFactory]
2122
}
2223

0 commit comments

Comments
 (0)