test(grpc-data): A2b smoke probe — scripted outcome is applied (2), method bits Primary-only, record comment/ClientUserId/marker
This commit is contained in:
@@ -272,6 +272,8 @@ try
|
||||
static object Record(W.ConditionState r) => new
|
||||
{
|
||||
key = r.ConditionKey, r.Version, r.Removed, r.StateKnown, r.Active, r.Acknowledged, r.Severity, r.Message,
|
||||
comment = r.HasComment ? r.Comment : null, clientUserId = r.HasClientUserId ? r.ClientUserId : null,
|
||||
activation = r.Activation is null ? null : r.Activation.Incarnation[..Math.Min(8, r.Activation.Incarnation.Length)] + ":" + r.Activation.Sequence,
|
||||
info = r.Info is null ? null : new { r.Info.ConditionType, r.Info.ConditionName, r.Info.SourceKind,
|
||||
placements = r.Info.Placements.Select(p => p.Address.NamespaceUri + "|" + p.Address.Identifier).ToArray() },
|
||||
};
|
||||
@@ -366,11 +368,16 @@ try
|
||||
var leaked = snapshot.Concat(deltas).Any(r => Record(r).ToString()!.Contains("modbus/plc", StringComparison.Ordinal));
|
||||
var ackJson = JsonSerializer.SerializeToElement(ackEvidence);
|
||||
var methodState = ackEvidence is null ? -1 : ackJson.GetProperty("firstState").GetInt32();
|
||||
var methodsOk = (featured.Operations & 384) == 384 && (plain.Operations & 384) == 0 && ackEvidence is not null
|
||||
// Method bits: with the header on the Primary only (stripped off-Primary), never without the header.
|
||||
// State: scripted ⇒ 2 (applied), native ⇒ 4 (AcceptedUnconfirmed); Secondary ⇒ 1 (RejectedBeforeDispatch).
|
||||
// The stream may carry more than one acked record (a state-only re-projection after the method's own record);
|
||||
// "exactly one ack" is the ORIGIN's event count, asserted by conditions_smoke.py.
|
||||
var scripted = snapshot.FirstOrDefault(r => r.Active && r.Info is not null)?.Info.SourceKind == 2;
|
||||
var methodsOk = (featured.Operations & 384) == (primary ? 384u : 0u) && (plain.Operations & 384) == 0 && ackEvidence is not null
|
||||
&& ackJson.GetProperty("headerless").GetString() == "FailedPrecondition"
|
||||
&& ackJson.GetProperty("duplicateEqual").GetBoolean()
|
||||
&& (primary
|
||||
? methodState == 4 && ackJson.GetProperty("duplicateEqual").GetBoolean()
|
||||
&& deltas.Count(r => r.Active && r.Acknowledged) == 1
|
||||
? methodState == (scripted ? 2 : 4) && deltas.Any(r => r.Active && r.Acknowledged && r.StateKnown)
|
||||
: methodState == 1);
|
||||
var passed = capsOk && methodsOk && (primary
|
||||
? ackStatus == 1 && total >= 1 && complete && snapshot.Count == total && snapshot.Any(r => r.Active && r.StateKnown)
|
||||
|
||||
Reference in New Issue
Block a user