Skip to content
Open
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: 0 additions & 6 deletions test/Kurrent.Replicator.Tests/ChaserCheckpointSeedingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ public ChaserCheckpointSeedingTests(ContainerFixture fixture) {
.ForContext<ChaserCheckpointSeedingTests>();
}

[Before(Test)]
public async Task Start() => await _fixture.StartContainers();

[After(Test)]
public async Task Stop() => await _fixture.StopContainers();

[Test]
public async Task Verify() {
var v5DataPath = _fixture.V5DataPath;
Expand Down
6 changes: 0 additions & 6 deletions test/Kurrent.Replicator.Tests/CustomPartitionerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ public ValuePartitionerTests(ContainerFixture fixture) {
.ForContext<ValuePartitionerTests>();
}

[Before(Test)]
public async Task Start() => await _fixture.StartContainers();

[After(Test)]
public async Task Stop() => await _fixture.StopContainers();

[Test]
public async Task ShouldKeepOrderWithinPartition() {
var checkpointStore = new CheckpointStore();
Expand Down
7 changes: 4 additions & 3 deletions test/Kurrent.Replicator.Tests/Fixtures/ContainerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
using EventStore.Client;
using EventStore.ClientAPI;
using Testcontainers.EventStoreDb;
using TUnit.Core.Interfaces;

namespace Kurrent.Replicator.Tests.Fixtures;

public class ContainerFixture {
public class ContainerFixture : IAsyncInitializer, IAsyncDisposable {
EventStoreDbContainer _kurrentDbContainer;
IContainer _eventStoreContainer;
public DirectoryInfo V5DataPath { get; private set; }

public async Task StartContainers() {
public async Task InitializeAsync() {
V5DataPath = Directory.CreateTempSubdirectory();
_kurrentDbContainer = BuildV23Container();
_eventStoreContainer = BuildV5Container(V5DataPath);
Expand All @@ -21,7 +22,7 @@ public async Task StartContainers() {
await Task.Delay(TimeSpan.FromSeconds(2)); // give it some time to spin up
}

public async Task StopContainers() {
public async ValueTask DisposeAsync() {
await Task.WhenAll(_kurrentDbContainer.StopAsync(), _eventStoreContainer.StopAsync());
await _eventStoreContainer.DisposeAsync();
await _kurrentDbContainer.DisposeAsync();
Expand Down