feat(mesh): ClusterRoleInfo exposes the node's own cluster-scoped role
Phase 6 Task 1. IClusterRoleInfo gains ClusterRole/ClusterId, derived from the node's configured AkkaClusterOptions.Roles at construction time (not live Cluster.State) so the identity is available before the cluster forms. First cluster-scoped role wins when more than one is configured, logged as a Warning. Updates the FakeClusterRoleInfo test double in ServiceCollectionExtensionsTests to satisfy the new interface members. Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW
This commit is contained in:
@@ -193,6 +193,10 @@ public sealed class ServiceCollectionExtensionsTests
|
||||
public NodeId LocalNode { get; } = NodeId.Parse("test-node");
|
||||
/// <summary>Gets the local roles.</summary>
|
||||
public IReadOnlySet<string> LocalRoles { get; } = new HashSet<string>(["driver"]);
|
||||
/// <summary>Gets the local node's cluster-scoped role. None configured in this fake.</summary>
|
||||
public string? ClusterRole => null;
|
||||
/// <summary>Gets the ClusterId extracted from <see cref="ClusterRole"/>. None configured in this fake.</summary>
|
||||
public string? ClusterId => null;
|
||||
/// <summary>Determines whether the local node has the specified role.</summary>
|
||||
/// <param name="role">The role to check.</param>
|
||||
public bool HasRole(string role) => LocalRoles.Contains(role);
|
||||
|
||||
Reference in New Issue
Block a user