Skip to content

Commit 3ac070d

Browse files
committed
chore: Update ClickHouseContainerTest modifier
1 parent 82adaaa commit 3ac070d

File tree

5 files changed

+27
-24
lines changed

5 files changed

+27
-24
lines changed

docs/modules/activemq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ You can start an Apache ActiveMQ Artemis container instance from any .NET applic
3030

3131
Connect to the container and produce a message:
3232

33-
=== "EstablishesConnection"
33+
=== "Establish connection"
3434
```csharp
35-
--8<-- "tests/Testcontainers.ActiveMq.Tests/ArtemisContainerTest.cs:ArtemisContainerEstablishesConnection"
35+
--8<-- "tests/Testcontainers.ActiveMq.Tests/ArtemisContainerTest.cs:EstablishConnection"
3636
```
3737

3838
The test example uses the following NuGet dependencies:

docs/modules/clickhouse.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,22 @@ You can start a ClickHouse container instance from any .NET application. This ex
1212

1313
=== "Test class"
1414
```csharp
15-
--8<-- "tests/Testcontainers.ClickHouse.Tests/ClickHouseContainerTest.docs.cs:Class"
15+
--8<-- "tests/Testcontainers.ClickHouse.Tests/ClickHouseContainerTest.docs.cs:UseClickHouseContainer"
1616
}
1717
```
1818

19-
Connecting to container example:
20-
=== "Connecting to ClickHouse"
19+
Connect to the container:
20+
21+
=== "Establish connection"
2122
```csharp
22-
--8<-- "tests/Testcontainers.ClickHouse.Tests/ClickHouseContainerTest.docs.cs:Connecting"
23+
--8<-- "tests/Testcontainers.ClickHouse.Tests/ClickHouseContainerTest.docs.cs:EstablishConnection"
2324
```
2425

25-
Execute SQL script example:
26-
=== "SQL Script"
26+
Execute a SQL script:
27+
28+
=== "Run SQL script"
2729
```csharp
28-
--8<-- "tests/Testcontainers.ClickHouse.Tests/ClickHouseContainerTest.docs.cs:SQLScript"
30+
--8<-- "tests/Testcontainers.ClickHouse.Tests/ClickHouseContainerTest.docs.cs:RunSQLScript"
2931
```
3032

3133
The test example uses the following NuGet dependencies:

tests/Testcontainers.ActiveMq.Tests/ArtemisContainerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ await DisposeAsyncCore()
3131
}
3232
// # --8<-- [end:UseArtemisContainer]
3333

34-
// # --8<-- [start:ArtemisContainerEstablishesConnection]
34+
// # --8<-- [start:EstablishConnection]
3535
[Fact]
3636
[Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
3737
public async Task EstablishesConnection()
@@ -74,7 +74,7 @@ await producer.SendAsync(producedMessage)
7474

7575
Assert.Equal(producedMessage.Text, receivedMessage.Body<string>());
7676
}
77-
// # --8<-- [end:ArtemisContainerEstablishesConnection]
77+
// # --8<-- [end:EstablishConnection]
7878

7979
protected virtual ValueTask DisposeAsyncCore()
8080
{
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
namespace Testcontainers.ClickHouse;
22

3-
public partial class ClickHouseContainerTest
3+
public abstract partial class ClickHouseContainerTest
44
{
5-
[UsedImplicitly]
6-
// <!-- -8<- [start:Class] -->
7-
public sealed class ClickHouseContainerTestDocumentation : IAsyncLifetime
5+
// <!-- -8<- [start:UseClickHouseContainer] -->
6+
public sealed class ClickHouseContainerExample : IAsyncLifetime
87
{
98
private readonly ClickHouseContainer _clickHouseContainer = new ClickHouseBuilder().Build();
109

1110
public async ValueTask DisposeAsync()
1211
{
13-
await _clickHouseContainer.DisposeAsync();
12+
await _clickHouseContainer.DisposeAsync()
13+
.ConfigureAwait(false);
1414
}
1515

1616
public async ValueTask InitializeAsync()
1717
{
18-
await _clickHouseContainer.StartAsync(TestContext.Current.CancellationToken);
18+
await _clickHouseContainer.StartAsync(TestContext.Current.CancellationToken)
19+
.ConfigureAwait(false);
1920
}
20-
// <!-- -8<- [end:Class] -->
21+
// <!-- -8<- [end:UseClickHouseContainer] -->
2122

22-
// <!-- -8<- [start:Connecting] -->
23+
// <!-- -8<- [start:EstablishConnection] -->
2324
[Fact]
2425
[Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
2526
public void ConnectionStateReturnsOpen()
@@ -33,9 +34,9 @@ public void ConnectionStateReturnsOpen()
3334
// Then
3435
Assert.Equal(ConnectionState.Open, connection.State);
3536
}
36-
// <!-- -8<- [end:Connecting] -->
37+
// <!-- -8<- [end:EstablishConnection] -->
3738

38-
// <!-- -8<- [start:SQLScript] -->
39+
// <!-- -8<- [start:RunSQLScript] -->
3940
[Fact]
4041
[Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
4142
public async Task ExecScriptReturnsSuccessful()
@@ -44,14 +45,13 @@ public async Task ExecScriptReturnsSuccessful()
4445
const string scriptContent = "SELECT 1;";
4546

4647
// When
47-
var execResult = await _clickHouseContainer
48-
.ExecScriptAsync(scriptContent, TestContext.Current.CancellationToken)
48+
var execResult = await _clickHouseContainer.ExecScriptAsync(scriptContent, CancellationToken.None)
4949
.ConfigureAwait(true);
5050

5151
// Then
5252
Assert.True(0L.Equals(execResult.ExitCode), execResult.Stderr);
5353
Assert.Empty(execResult.Stderr);
5454
}
55-
// <!-- -8<- [end:SQLScript] -->
55+
// <!-- -8<- [end:RunSQLScript] -->
5656
}
5757
}

tests/Testcontainers.ClickHouse.Tests/Usings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
global using System.Data;
22
global using System.Data.Common;
3+
global using System.Threading;
34
global using System.Threading.Tasks;
45
global using ClickHouse.Client.ADO;
56
global using DotNet.Testcontainers.Builders;

0 commit comments

Comments
 (0)