Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove SharedContainerInstance and use ContainerFixture instead #1378

Merged
merged 3 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
23 changes: 0 additions & 23 deletions tests/Testcontainers.Commons/SharedContainerInstance.cs

This file was deleted.

1 change: 0 additions & 1 deletion tests/Testcontainers.Commons/Testcontainers.Commons.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0"/>
<PackageReference Include="xunit"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../../src/Testcontainers/Testcontainers.csproj"/>
Expand Down
5 changes: 1 addition & 4 deletions tests/Testcontainers.Commons/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
global using System.Diagnostics;
global using System.IO;
global using System.Text;
global using System.Threading.Tasks;
global using DotNet.Testcontainers.Containers;
global using DotNet.Testcontainers.Images;
global using JetBrains.Annotations;
global using Xunit;
global using JetBrains.Annotations;
12 changes: 6 additions & 6 deletions tests/Testcontainers.PostgreSql.Tests/PostgreSqlContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public async Task ExecScriptReturnsSuccessful()
}
// # --8<-- [end:UsePostgreSqlContainer]

public sealed class ReuseContainerTest : IClassFixture<SharedPostgreSqlInstance>, IDisposable
public sealed class ReuseContainerTest : IClassFixture<PostgreSqlFixture>, IDisposable
{
private readonly CancellationTokenSource _cts = new CancellationTokenSource(TimeSpan.FromMinutes(1));

private readonly SharedContainerInstance<PostgreSqlContainer> _fixture;
private readonly PostgreSqlFixture _fixture;

public ReuseContainerTest(SharedPostgreSqlInstance fixture)
public ReuseContainerTest(PostgreSqlFixture fixture)
{
_fixture = fixture;
}
Expand All @@ -79,10 +79,10 @@ await _fixture.Container.StartAsync(_cts.Token)
}

[UsedImplicitly]
public sealed class SharedPostgreSqlInstance : SharedContainerInstance<PostgreSqlContainer>
public sealed class PostgreSqlFixture : ContainerFixture<PostgreSqlBuilder, PostgreSqlContainer>
{
public SharedPostgreSqlInstance()
: base(new PostgreSqlBuilder().Build())
public PostgreSqlFixture(IMessageSink messageSink)
: base(messageSink)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../../src/Testcontainers.PostgreSql/Testcontainers.PostgreSql.csproj"/>
<ProjectReference Include="../../src/Testcontainers.Xunit/Testcontainers.Xunit.csproj" />
<ProjectReference Include="../Testcontainers.Commons/Testcontainers.Commons.csproj"/>
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion tests/Testcontainers.PostgreSql.Tests/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
global using System.Data.Common;
global using System.Threading;
global using System.Threading.Tasks;
global using Testcontainers.Xunit;
global using DotNet.Testcontainers.Commons;
global using JetBrains.Annotations;
global using Npgsql;
global using Xunit;
global using Xunit;
global using Xunit.Abstractions;