test(script-worker): #1100 the shadow census's unsupported-type example is a jagged array — a decimal is now refused by both runners alike and matches
ShadowModeTests counted 'return 1.5m;' as an unsupported_type mismatch (in process Ok decimal, worker
'unsupported type'). Since 9dbccf231 both runners refuse it with the same reason, so it matches; the one
result the worker alone still refuses is a jagged array (no nested-array wire tag), which takes its place.
This commit is contained in:
@@ -102,7 +102,10 @@ public sealed class ShadowModeTests
|
||||
["quality"] = "return ctx.GetTag(\"i\").StatusCode;",
|
||||
["throws"] = "if ((int)ctx.GetTag(\"i\").Value >= 0) throw new InvalidOperationException(\"boom \" + ctx.GetTag(\"i\").Value); return 0;",
|
||||
["divergent"] = $"return {InWorker} ? 2 : 1;",
|
||||
// lmxopcua#1100: a decimal is refused by both runners alike now (no OPC UA node can carry it), so it MATCHES;
|
||||
// the one result shape left that only the worker refuses is a jagged array (no nested-array wire tag).
|
||||
["decimal"] = "return 1.5m;",
|
||||
["jagged"] = "return new[] { new[] { (int)ctx.GetTag(\"i\").Value } };",
|
||||
};
|
||||
|
||||
for (var i = 0; i < 3; i++)
|
||||
@@ -122,12 +125,12 @@ public sealed class ShadowModeTests
|
||||
stats.Compared.ShouldBe(scripts.Count * 3);
|
||||
stats.Mismatched.ShouldBe(6, string.Join(Environment.NewLine, shadow.Mismatches.Select(m => $"{m.Key}: {m.LastReason} — {m.LastSummary}")));
|
||||
var mismatches = shadow.Mismatches.ToDictionary(m => m.Key);
|
||||
mismatches.Keys.ShouldBe(["decimal", "divergent"], ignoreOrder: true);
|
||||
mismatches.Keys.ShouldBe(["jagged", "divergent"], ignoreOrder: true);
|
||||
mismatches["divergent"].LastReason.ShouldBe("value");
|
||||
mismatches["divergent"].LastSummary.ShouldBe("published Ok Int32 1; shadow Ok Int32 2");
|
||||
mismatches["divergent"].Count.ShouldBe(3);
|
||||
mismatches["decimal"].LastReason.ShouldBe("unsupported_type");
|
||||
mismatches["decimal"].LastSummary.ShouldContain("System.Decimal");
|
||||
mismatches["jagged"].LastReason.ShouldBe("unsupported_type");
|
||||
mismatches["jagged"].LastSummary.ShouldContain("System.Int32[][]");
|
||||
|
||||
var lines = log.Events.Where(e => e.MessageTemplate.Text.StartsWith("Script shadow mismatch", StringComparison.Ordinal)).ToArray();
|
||||
lines.Length.ShouldBe(2, "one line per script and reason");
|
||||
|
||||
Reference in New Issue
Block a user