Skip to content

Commit

Permalink
fix issue with conflicts between the multiple sync tests running at o…
Browse files Browse the repository at this point in the history
…nce. Also fixes issues where previous projects would not be cleaned up
  • Loading branch information
hahn-kev committed Dec 3, 2024
1 parent aaca6ed commit 0068f9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 4 additions & 8 deletions backend/FwLite/FwLiteProjectSync.Tests/Fixtures/SyncFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
using FwDataMiniLcmBridge;
using FwDataMiniLcmBridge.Api;
using FwDataMiniLcmBridge.LcmUtils;
using FwDataMiniLcmBridge.Tests.Fixtures;
using LcmCrdt;
using LexCore.Utils;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MiniLcm;

namespace FwLiteProjectSync.Tests.Fixtures;

Expand All @@ -23,19 +19,19 @@ public class SyncFixture : IAsyncLifetime
private readonly string _projectName;
private readonly IDisposable _cleanup;

public static SyncFixture Create([CallerMemberName] string projectName = "") => new(projectName);
public static SyncFixture Create([CallerMemberName] string projectName = "", [CallerMemberName] string projectFolder = "") => new(projectName, projectFolder);

private SyncFixture(string projectName)
private SyncFixture(string projectName, string projectFolder)
{
_projectName = projectName;
var crdtServices = new ServiceCollection()
.AddSyncServices(_projectName);
.AddSyncServices(projectFolder);
var rootServiceProvider = crdtServices.BuildServiceProvider();
_cleanup = Defer.Action(() => rootServiceProvider.Dispose());
_services = rootServiceProvider.CreateAsyncScope();
}

public SyncFixture(): this("sena-3_" + Guid.NewGuid().ToString("N"))
public SyncFixture(): this("sena-3_" + Guid.NewGuid().ToString("N"), "FwLiteSyncFixture")
{
}

Expand Down
2 changes: 0 additions & 2 deletions backend/FwLite/FwLiteProjectSync.Tests/SyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ public async Task DisposeAsync()
{
await _fixture.CrdtApi.DeleteEntry(entry.Id);
}

_fixture.DeleteSyncSnapshot();
}

public SyncTests(SyncFixture fixture)
Expand Down

0 comments on commit 0068f9f

Please sign in to comment.