Skip to content

Commit

Permalink
remove unused reference.confg from DistributedData.LightningDb (#7294)
Browse files Browse the repository at this point in the history
These configuration values are read from and used by `DistributedData/reference.conf`, so this unused duplicate file is confusing and unnecessary.
  • Loading branch information
Aaronontheweb authored Jul 22, 2024
1 parent d3b3613 commit a6daed7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Akka.Cluster.Sharding.Tests
{
/// <summary>
/// Test migration from old persistent shard coordinator with remembered
/// entities to using a ddatabacked shard coordinator with an event sourced
/// entities to using a ddata-backed shard coordinator with an event sourced
/// replicated entity store.
/// </summary>
public class PersistentShardingMigrationSpec : AkkaSpec
Expand Down Expand Up @@ -171,11 +171,11 @@ class = ""Akka.Cluster.Sharding.Tests.MemorySnapshotStoreShared, Akka.Cluster.Sh
}");


private Config configForNewMode;
private readonly Config _configForNewMode;

public PersistentShardingMigrationSpec(ITestOutputHelper helper) : base(SpecConfig, helper)
{
configForNewMode = ConfigForNewMode.WithFallback(Sys.Settings.Config);
_configForNewMode = ConfigForNewMode.WithFallback(Sys.Settings.Config);
}

protected override void AtStartup()
Expand All @@ -187,7 +187,7 @@ protected override void AtStartup()
[Fact]
public void Migration_should_allow_migration_of_remembered_shards_and_not_allow_going_back()
{
var typeName = "Migration";
const string typeName = "Migration";

WithSystem(Sys.Settings.Config, typeName, "OldMode", (_, region, _) =>
{
Expand All @@ -200,16 +200,28 @@ public void Migration_should_allow_migration_of_remembered_shards_and_not_allow_
ExpectMsg("ack");
});

WithSystem(configForNewMode, typeName, "NewMode", (system, region, rememberedEntitiesProbe) =>
WithSystem(_configForNewMode, typeName, "NewMode", (system, region, rememberedEntitiesProbe) =>
{
AssertRegionRegistrationComplete(region);
var probe = CreateTestProbe(system);
region.Tell(new Message(1), probe.Ref);
probe.ExpectMsg("ack");
ImmutableHashSet.Create(
rememberedEntitiesProbe.ExpectMsg<string>(),
rememberedEntitiesProbe.ExpectMsg<string>(),
rememberedEntitiesProbe.ExpectMsg<string>()).Should().BeEquivalentTo("1", "2", "3"); // 1-2 from the snapshot, 3 from a replayed message
// due to retries in the remember-entities system, we have to tolerate
// potentially receiving a duplicate message for the same entity
// therefore, we need to wait for at least 3 distinct messages or until the timeout
var maxTimeout = TimeSpan.FromSeconds(5);
var found = ImmutableHashSet<string>.Empty;
Within(maxTimeout, () =>
{
while(found.Count < 3 && RemainingOrDefault > TimeSpan.Zero)
{
var msg = rememberedEntitiesProbe.ExpectMsg<string>();
found = found.Add(msg);
}
});
found.Should().BeEquivalentTo("1", "2", "3"); // 1-2 from the snapshot, 3 from a replayed message
rememberedEntitiesProbe.ExpectNoMsg();
});

Expand All @@ -224,11 +236,11 @@ public void Migration_should_allow_migration_of_remembered_shards_and_not_allow_
[Fact]
public void Migration_should_not_allow_going_back_to_persistence_mode_based_on_a_snapshot()
{
var typeName = "Snapshots";
WithSystem(configForNewMode, typeName, "NewMode", (system, region, _) =>
const string typeName = "Snapshots";
WithSystem(_configForNewMode, typeName, "NewMode", (system, region, _) =>
{
var probe = CreateTestProbe(system);
for (int i = 1; i <= 5; i++)
for (var i = 1; i <= 5; i++)
{
region.Tell(new Message(i), probe.Ref);
probe.ExpectMsg("ack");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="reference.conf"/>
<ProjectReference Include="..\Akka.DistributedData\Akka.DistributedData.csproj"/>
</ItemGroup>

Expand Down

This file was deleted.

0 comments on commit a6daed7

Please sign in to comment.