fix(cluster): AkkaClusterOptions.Roles is the EffectiveRoles instance, not a second derivation
This commit is contained in:
@@ -94,4 +94,34 @@ public class AkkaClusterOptionsRoleFallbackTests
|
||||
RoleParser.ClusterIdFromRoles(Bind().Roles).ShouldBe("site-a");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// R3-04 (structural identity, choice 3): <c>AkkaClusterOptions.Roles</c> is not a SECOND
|
||||
/// derivation of the role rule — it is the registered <see cref="EffectiveRoles"/> instance's
|
||||
/// <see cref="EffectiveRoles.Gossiped"/> list, verbatim. A mixed-case configured role proves
|
||||
/// both the normalization (plain lowered, cluster suffix preserved) and the identity: the two
|
||||
/// views can never disagree because there is only one derivation.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Bound_options_Roles_IS_the_registered_EffectiveRoles_Gossiped_list()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddInMemoryCollection(new Dictionary<string, string?>
|
||||
{
|
||||
["Cluster:Roles:0"] = "Driver",
|
||||
["Cluster:Roles:1"] = "Cluster-SITE-A",
|
||||
})
|
||||
.Build();
|
||||
|
||||
var services = new ServiceCollection();
|
||||
services.AddLogging();
|
||||
services.AddOtOpcUaCluster(configuration);
|
||||
var provider = services.BuildServiceProvider();
|
||||
|
||||
var bound = provider.GetRequiredService<IOptions<AkkaClusterOptions>>().Value;
|
||||
var effectiveRoles = provider.GetRequiredService<EffectiveRoles>();
|
||||
|
||||
bound.Roles.ShouldBe(new[] { "driver", "cluster-SITE-A" });
|
||||
bound.Roles.ShouldBe(effectiveRoles.Gossiped);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user