test(grpc-data): A4 live scenarios part 2 harness — A03 origin failover (same-incarnation stream reset via mapping revision bump, clear-and-re-raise in the gap, RefreshRequired, BadEventIdUnknown, refreshed EventId acks), A06 consumer Primary change across both nodes + second CONSUMER principal fixture-cli-alt, A07 consumer restart refresh-vs-barrier; CLI alarms prints EventType (names RefreshStart/End/Required)
This commit is contained in:
@@ -175,7 +175,7 @@ try
|
||||
var root = mutation.RootElement;
|
||||
string[] allowedFields = ["connection_id", "target_mode", "target_node_id", "consistency", "consumer_node_ids", "connection_enabled", "connection_allowed_operations",
|
||||
"mapping_enabled", "write_through", "allowed_operations", "export_id", "export_enabled", "export_allowed_operations", "source_redundancy_mode", "consumer_redundancy_mode",
|
||||
"control_redundancy_mode", "rename_tag", "upsert_tag", "upsert_reference", "remove_tag_id", "disable_feature", "key_action", "key_expiry_seconds", "upsert_connection", "upsert_mapping", "upsert_export", "remove_mapping_id", "maintenance_mode", "acl_permissions"];
|
||||
"control_redundancy_mode", "rename_tag", "upsert_tag", "upsert_reference", "remove_tag_id", "disable_feature", "key_action", "key_expiry_seconds", "upsert_connection", "upsert_mapping", "upsert_export", "remove_mapping_id", "maintenance_mode", "acl_permissions", "bump_mapping_revision"];
|
||||
if (root.ValueKind != JsonValueKind.Object || root.EnumerateObject().Any(property => !allowedFields.Contains(property.Name, StringComparer.Ordinal)))
|
||||
throw new InvalidOperationException("unknown fixture mutation field");
|
||||
await using var db = await factory.CreateDbContextAsync();
|
||||
@@ -223,6 +223,13 @@ try
|
||||
if (existing is null) db.DataExports.Add(candidate);
|
||||
else { candidate.DataExportRowId = existing.DataExportRowId; db.Entry(existing).CurrentValues.SetValues(candidate); }
|
||||
}
|
||||
if (root.TryGetProperty("bump_mapping_revision", out var bumpMapping))
|
||||
{
|
||||
// A03: a consumer condition-stream reset against the SAME origin incarnation — a changed mapping revision restarts the
|
||||
// connection's condition runner (new stream + complete snapshot, materialised conditions handed over).
|
||||
var bumped = await db.RemoteNamespaceMappings.SingleAsync(x => x.RemoteNamespaceMappingId == bumpMapping.GetString());
|
||||
bumped.Revision++;
|
||||
}
|
||||
if (root.TryGetProperty("remove_mapping_id", out var removeMapping))
|
||||
await db.RemoteNamespaceMappings.Where(x => x.RemoteNamespaceMappingId == removeMapping.GetString()).ExecuteDeleteAsync();
|
||||
var connectionId = root.TryGetProperty("connection_id", out var selected) ? selected.GetString() : "consumer-source";
|
||||
@@ -463,6 +470,10 @@ try
|
||||
db.NodeAcls.Add(new() { NodeAclRowId = Guid.NewGuid(), NodeAclId = "source-peer-unsonly", ClusterId = "SOURCE", Principal = "fixture-unsonly",
|
||||
ScopeKind = NodeAclScopeKind.Cluster, PermissionFlags = NodePermissions.Admin });
|
||||
// A05: the CONSUMER-local principal `fixture-cli-nogrant` deliberately has NO NodeAcl row (no mapping grant).
|
||||
// A06: a SECOND granted CONSUMER principal, so the two consumer pair members can be watched under different
|
||||
// principals (the imported ConditionId must not depend on who asks).
|
||||
db.NodeAcls.Add(new() { NodeAclRowId = Guid.NewGuid(), NodeAclId = "cli-alt-CONSUMER", ClusterId = "CONSUMER", Principal = "fixture-cli-alt",
|
||||
ScopeKind = NodeAclScopeKind.Cluster, PermissionFlags = NodePermissions.Admin });
|
||||
}
|
||||
if (history)
|
||||
// The second principal's origin ACL also lacks HistoryRead: with its export's HistoryRead off the RPC is refused
|
||||
@@ -478,6 +489,7 @@ try
|
||||
{
|
||||
await SaveText("source-unsonly.key", await seedAdmin.CreateAsync("source-issued-unsonly", "fixture-unsonly", null, "SOURCE UNS-only export (A04)", default));
|
||||
await SaveText("cli-nogrant.key", await seedAdmin.CreateAsync("fixture-cli-nogrant", "fixture-cli-nogrant", null, "CONSUMER principal without a mapping grant (A05)", default));
|
||||
await SaveText("cli-alt.key", await seedAdmin.CreateAsync("fixture-cli-alt", "fixture-cli-alt", null, "second granted CONSUMER principal (A06)", default));
|
||||
}
|
||||
if (history)
|
||||
await SaveText("source-nohistory.key", await seedAdmin.CreateAsync("source-issued-nohistory", "fixture-nohistory", null, "SOURCE export without HistoryRead", default));
|
||||
|
||||
Reference in New Issue
Block a user