Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
<PackageVersion Include="Dapper" Version="2.1.66"/>
<PackageVersion Include="ReflectionMagic" Version="5.0.1"/>
<PackageVersion Include="xunit.analyzers" Version="1.21.0"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.0"/>
<PackageVersion Include="xunit" Version="2.9.3"/>
<PackageVersion Include="xunit.v3" Version="2.0.1"/>
<PackageVersion Include="xunit.v3" Version="2.0.2"/>
<!-- xUnit.net extensibility for Testcontainers.Xunit and Testcontainers.XunitV3 packages: -->
<PackageVersion Include="xunit.extensibility.execution" Version="2.9.3"/>
<PackageVersion Include="xunit.v3.extensibility.core" Version="1.1.0"/>
<PackageVersion Include="xunit.v3.extensibility.core" Version="2.0.2"/>
<!-- Third-party client dependencies to connect and interact with the containers: -->
<PackageVersion Include="Apache.NMS.ActiveMQ" Version="2.1.1"/>
<PackageVersion Include="ArangoDBNetStandard" Version="2.0.1"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers.FirebirdSql/FirebirdSqlConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public FirebirdSqlConfiguration(FirebirdSqlConfiguration oldValue, FirebirdSqlCo
/// <summary>
/// Gets the FirebirdSql database.
/// </summary>
public string Database => Image.Tag.StartsWith("2.5") || Image.Tag.StartsWith("v2.5") ? string.Join("/", "/firebird/data", _database) : _database;
public string Database => Image.Tag != null && (Image.Tag.StartsWith("2.5") || Image.Tag.StartsWith("v2.5")) ? string.Join("/", "/firebird/data", _database) : _database;

/// <summary>
/// Gets the FirebirdSql username.
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers.Xunit/Testcontainers.Xunit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/>
<PackageReference Include="xunit.analyzers" PrivateAssets="all"/>
<PackageReference Include="xunit.analyzers" PrivateAssets="All"/>
<PackageReference Include="xunit.extensibility.execution"/>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/>
<PackageReference Include="xunit.analyzers" PrivateAssets="all"/>
<PackageReference Include="xunit.analyzers" PrivateAssets="All"/>
<PackageReference Include="xunit.v3.extensibility.core"/>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers/Clients/TestcontainersClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal sealed class TestcontainersClient : ITestcontainersClient

public const string TestcontainersReuseHashLabel = TestcontainersLabel + ".reuse-hash";

public static readonly string Version = typeof(TestcontainersClient).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
public static readonly string Version = typeof(TestcontainersClient).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;

private static readonly string OSRootDirectory = Path.GetPathRoot(Directory.GetCurrentDirectory());

Expand Down
9 changes: 5 additions & 4 deletions tests/Testcontainers.ActiveMq.Tests/ArtemisContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ private ArtemisContainerTest(ArtemisContainer artemisContainer, string username,
_password = password;
}

public Task InitializeAsync()
public async ValueTask InitializeAsync()
{
return _artemisContainer.StartAsync();
await _artemisContainer.StartAsync()
.ConfigureAwait(false);
}

public Task DisposeAsync()
public ValueTask DisposeAsync()
{
return _artemisContainer.DisposeAsync().AsTask();
return _artemisContainer.DisposeAsync();
}
// # --8<-- [end:UseArtemisContainer]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<!-- -8<- [start:PackageReferences] -->
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Apache.NMS.ActiveMQ"/>
<!-- -8<- [end:PackageReferences] -->
</ItemGroup>
Expand Down
11 changes: 6 additions & 5 deletions tests/Testcontainers.ArangoDb.Tests/ArangoDbContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ public sealed class ArangoDbContainerTest : IAsyncLifetime
{
private readonly ArangoDbContainer _arangoDbContainer = new ArangoDbBuilder().Build();

public Task InitializeAsync()
public async ValueTask InitializeAsync()
{
return _arangoDbContainer.StartAsync();
await _arangoDbContainer.StartAsync()
.ConfigureAwait(false);
}

public Task DisposeAsync()
public ValueTask DisposeAsync()
{
return _arangoDbContainer.DisposeAsync().AsTask();
return _arangoDbContainer.DisposeAsync();
}

[Fact]
Expand All @@ -26,7 +27,7 @@ public async Task RetrievesDatabases()
using var client = new ArangoDBClient(transport);

// When
var response = await client.Database.GetDatabasesAsync()
var response = await client.Database.GetDatabasesAsync(TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="ArangoDBNetStandard"/>
</ItemGroup>
<ItemGroup>
Expand Down
17 changes: 9 additions & 8 deletions tests/Testcontainers.Azurite.Tests/AzuriteContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ private AzuriteContainerTest(AzuriteContainer azuriteContainer)
_azuriteContainer = azuriteContainer;
}

public Task InitializeAsync()
public async ValueTask InitializeAsync()
{
return _azuriteContainer.StartAsync();
await _azuriteContainer.StartAsync()
.ConfigureAwait(false);
}

public Task DisposeAsync()
public ValueTask DisposeAsync()
{
return _azuriteContainer.DisposeAsync().AsTask();
return _azuriteContainer.DisposeAsync();
}

[Fact]
Expand All @@ -27,7 +28,7 @@ public async Task EstablishesBlobServiceConnection()
var client = new BlobServiceClient(_azuriteContainer.GetConnectionString());

// When
var properties = await client.GetPropertiesAsync()
var properties = await client.GetPropertiesAsync(TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Expand All @@ -42,7 +43,7 @@ public async Task EstablishesQueueServiceConnection()
var client = new QueueServiceClient(_azuriteContainer.GetConnectionString());

// When
var properties = await client.GetPropertiesAsync()
var properties = await client.GetPropertiesAsync(TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Expand All @@ -57,7 +58,7 @@ public async Task EstablishesTableServiceConnection()
var client = new TableServiceClient(_azuriteContainer.GetConnectionString());

// When
var properties = await client.GetPropertiesAsync()
var properties = await client.GetPropertiesAsync(TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Expand Down Expand Up @@ -106,7 +107,7 @@ public AzuriteMemoryLimitConfiguration()
public async Task MemoryLimitIsConfigured()
{
// Given
var (stdout, _) = await _azuriteContainer.GetLogsAsync(timestampsEnabled: false)
var (stdout, _) = await _azuriteContainer.GetLogsAsync(timestampsEnabled: false, ct: TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Azure.Data.Tables"/>
<PackageReference Include="Azure.Storage.Blobs"/>
<PackageReference Include="Azure.Storage.Queues"/>
Expand Down
19 changes: 10 additions & 9 deletions tests/Testcontainers.BigQuery.Tests/BigQueryContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ public sealed class BigQueryContainerTest : IAsyncLifetime
{
private readonly BigQueryContainer _bigQueryContainer = new BigQueryBuilder().Build();

public Task InitializeAsync()
public async ValueTask InitializeAsync()
{
return _bigQueryContainer.StartAsync();
await _bigQueryContainer.StartAsync()
.ConfigureAwait(false);
}

public Task DisposeAsync()
public ValueTask DisposeAsync()
{
return _bigQueryContainer.DisposeAsync().AsTask();
return _bigQueryContainer.DisposeAsync();
}

[Fact]
Expand Down Expand Up @@ -41,20 +42,20 @@ public async Task ExecuteQueryReturnsInsertRow()
expectedRow.Add("gameStarted", utcNowWithoutMilliseconds);
expectedRow.Add("score", 85L);

using var bigQueryClient = await bigQueryClientBuilder.BuildAsync()
using var bigQueryClient = await bigQueryClientBuilder.BuildAsync(TestContext.Current.CancellationToken)
.ConfigureAwait(true);

var dataset = await bigQueryClient.GetOrCreateDatasetAsync("mydata")
var dataset = await bigQueryClient.GetOrCreateDatasetAsync("mydata", cancellationToken: TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// When
var table = await dataset.CreateTableAsync("scores", tableSchema)
var table = await dataset.CreateTableAsync("scores", tableSchema, cancellationToken: TestContext.Current.CancellationToken)
.ConfigureAwait(true);

_ = await table.InsertRowAsync(expectedRow)
_ = await table.InsertRowAsync(expectedRow, cancellationToken: TestContext.Current.CancellationToken)
.ConfigureAwait(true);

var results = await bigQueryClient.ExecuteQueryAsync($"SELECT * FROM {table}", null)
var results = await bigQueryClient.ExecuteQueryAsync($"SELECT * FROM {table}", null, cancellationToken: TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Google.Cloud.BigQuery.V2"/>
</ItemGroup>
<ItemGroup>
Expand Down
11 changes: 6 additions & 5 deletions tests/Testcontainers.Bigtable.Tests/BigtableContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ public sealed class BigtableContainerTest : IAsyncLifetime
{
private readonly BigtableContainer _bigtableContainer = new BigtableBuilder().Build();

public Task InitializeAsync()
public async ValueTask InitializeAsync()
{
return _bigtableContainer.StartAsync();
await _bigtableContainer.StartAsync()
.ConfigureAwait(false);
}

public Task DisposeAsync()
public ValueTask DisposeAsync()
{
return _bigtableContainer.DisposeAsync().AsTask();
return _bigtableContainer.DisposeAsync();
}

[Fact]
Expand Down Expand Up @@ -42,7 +43,7 @@ public async Task GetTableReturnsCreateTable()
bigtableClientBuilder.ChannelCredentials = ChannelCredentials.Insecure;

// When
var bigtableClient = await bigtableClientBuilder.BuildAsync()
var bigtableClient = await bigtableClientBuilder.BuildAsync(TestContext.Current.CancellationToken)
.ConfigureAwait(true);

_ = await bigtableClient.CreateTableAsync(instanceName, tableName.TableId, table)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="Google.Cloud.Bigtable.Admin.V2"/>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task ExecScriptAsyncReturnsSuccess()
const string selectFromSystemLocalStatement = "SELECT * FROM system.local;";

// When
var execResult = await fixture.Container.ExecScriptAsync(selectFromSystemLocalStatement)
var execResult = await fixture.Container.ExecScriptAsync(selectFromSystemLocalStatement, TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<!-- -8<- [start:PackageReferences] -->
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="CassandraCSharpDriver"/>
<!-- -8<- [end:PackageReferences] -->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../../src/Testcontainers.Cassandra/Testcontainers.Cassandra.csproj"/>
<ProjectReference Include="../../src/Testcontainers.Xunit/Testcontainers.Xunit.csproj"/>
<ProjectReference Include="../../src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj"/>
<ProjectReference Include="../Testcontainers.Commons/Testcontainers.Commons.csproj"/>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion tests/Testcontainers.Cassandra.Tests/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
global using JetBrains.Annotations;
global using Testcontainers.Xunit;
global using Xunit;
global using Xunit.Abstractions;
global using Xunit.Sdk;
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task ExecScriptReturnsSuccessful()
const string scriptContent = "SELECT 1;";

// When
var execResult = await fixture.Container.ExecScriptAsync(scriptContent)
var execResult = await fixture.Container.ExecScriptAsync(scriptContent, TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="ClickHouse.Client"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../../src/Testcontainers.ClickHouse/Testcontainers.ClickHouse.csproj"/>
<ProjectReference Include="../../src/Testcontainers.Xunit/Testcontainers.Xunit.csproj"/>
<ProjectReference Include="../../src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj"/>
<ProjectReference Include="../Testcontainers.Commons/Testcontainers.Commons.csproj"/>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion tests/Testcontainers.ClickHouse.Tests/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
global using JetBrains.Annotations;
global using Testcontainers.Xunit;
global using Xunit;
global using Xunit.Abstractions;
global using Xunit.Sdk;
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task ExecScriptReturnsSuccessful()
const string scriptContent = "SELECT 1;";

// When
var execResult = await fixture.Container.ExecScriptAsync(scriptContent)
var execResult = await fixture.Container.ExecScriptAsync(scriptContent, TestContext.Current.CancellationToken)
.ConfigureAwait(true);

// Then
Expand Down
Loading