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

remove unused reference.conf from DistributedData.LightningDb #7294

Merged
merged 4 commits into from
Jul 22, 2024
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
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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardened the spec here - the comment above explains the change.

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.