-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fed3d52
commit 18bdbbb
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Threading.Tasks; | ||
using Akka.Actor; | ||
using Akka.Cluster.Sharding; | ||
using Akka.Hosting; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Akka.Cluster.Hosting.Tests; | ||
|
||
public class DDataOptionsSpecs | ||
{ | ||
public DDataOptionsSpecs(ITestOutputHelper output) | ||
{ | ||
Output = output; | ||
} | ||
|
||
public ITestOutputHelper Output { get; } | ||
|
||
public static readonly TheoryData<DDataOptions> DDataOptionsTypes = new TheoryData<DDataOptions>() | ||
{ | ||
new DDataOptions() // empty | ||
{ | ||
Durable = new DurableOptions() | ||
{ | ||
Keys = [] | ||
} | ||
}, | ||
new DDataOptions() // null | ||
{ | ||
Durable = new DurableOptions() | ||
{ | ||
Keys = null | ||
} | ||
}, | ||
}; | ||
|
||
/// <summary> | ||
/// Reproduction for https://github.com/akkadotnet/Akka.Hosting/issues/512 | ||
/// </summary> | ||
[Theory] | ||
[MemberData(nameof(DDataOptionsTypes))] | ||
public async Task Should_not_emit_durable_keys_when_empty(DDataOptions options) | ||
{ | ||
// arrange | ||
using var host = await TestHelper.CreateHost(builder => { builder.WithDistributedData(options); }, | ||
new ClusterOptions() { Roles = new[] { "my-host" } }, Output); | ||
|
||
var actorSystem = host.Services.GetRequiredService<ActorSystem>(); | ||
|
||
// act | ||
var config = actorSystem.Settings.Config.GetConfig("akka.cluster.distributed-data"); | ||
|
||
// assert | ||
Assert.True(config.HasPath("durable.keys")); | ||
var keys = config.GetStringList("durable.keys"); | ||
Assert.Empty(keys); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters