test: preserve server SDK 2.0 value security and history contracts
This commit is contained in:
+10
-10
@@ -111,7 +111,7 @@ public sealed class NodeManagerHistoryReadConcurrencyTests : IDisposable
|
||||
// Node index 3's tagname throws; all others return a single good sample.
|
||||
var fake = new PerTagnameFake(tagname => tagname == "WW.Tag3"
|
||||
? throw new InvalidOperationException("backend boom for Tag3")
|
||||
: new HistorianRead(new[] { new DataValueSnapshot(1.0f, StatusCodes.Good, src, srv) }, null));
|
||||
: new HistorianRead(new[] { new DataValueSnapshot(1.0f, StatusCodes.Good.Code, src, srv) }, null));
|
||||
nm.HistorianDataSource = fake;
|
||||
|
||||
var nodeIds = MaterializeHistorizedNodes(nm, count: 8);
|
||||
@@ -132,12 +132,12 @@ public sealed class NodeManagerHistoryReadConcurrencyTests : IDisposable
|
||||
if (i == 3)
|
||||
{
|
||||
StatusCode.IsBad(errors[i].StatusCode).ShouldBeTrue();
|
||||
errors[i].StatusCode.Code.ShouldBe(StatusCodes.BadHistoryOperationUnsupported);
|
||||
errors[i].StatusCode.Code.ShouldBe(StatusCodes.BadHistoryOperationUnsupported.Code);
|
||||
}
|
||||
else
|
||||
{
|
||||
errors[i].StatusCode.Code.ShouldBe(StatusCodes.Good);
|
||||
results[i].StatusCode.Code.ShouldBe(StatusCodes.Good);
|
||||
errors[i].StatusCode.Code.ShouldBe(StatusCodes.Good.Code);
|
||||
results[i].StatusCode.Code.ShouldBe(StatusCodes.Good.Code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public sealed class NodeManagerHistoryReadConcurrencyTests : IDisposable
|
||||
.WaitAsync(TimeSpan.FromSeconds(10), Ct);
|
||||
|
||||
for (var i = 0; i < 4; i++)
|
||||
errors[i].StatusCode.Code.ShouldBe(StatusCodes.BadTimeout);
|
||||
errors[i].StatusCode.Code.ShouldBe(StatusCodes.BadTimeout.Code);
|
||||
|
||||
await host.DisposeAsync();
|
||||
}
|
||||
@@ -212,7 +212,7 @@ public sealed class NodeManagerHistoryReadConcurrencyTests : IDisposable
|
||||
// Second concurrent batch: the limiter is saturated → all handles BadTooManyOperations.
|
||||
var (_, errors2) = await Task.Run(() => InvokeHistoryRead(server, nm, details, ids[1]), Ct)
|
||||
.WaitAsync(TimeSpan.FromSeconds(5), Ct);
|
||||
errors2[0].StatusCode.Code.ShouldBe(StatusCodes.BadTooManyOperations);
|
||||
errors2[0].StatusCode.Code.ShouldBe(StatusCodes.BadTooManyOperations.Code);
|
||||
fake.Entered.ShouldBe(1, "the rejected batch must never reach the backend");
|
||||
|
||||
// Release the parked batch; the slot frees and a later read succeeds.
|
||||
@@ -221,7 +221,7 @@ public sealed class NodeManagerHistoryReadConcurrencyTests : IDisposable
|
||||
|
||||
var (_, errors3) = await Task.Run(() => InvokeHistoryRead(server, nm, details, ids[1]), Ct)
|
||||
.WaitAsync(TimeSpan.FromSeconds(10), Ct);
|
||||
errors3[0].StatusCode.Code.ShouldBe(StatusCodes.Good);
|
||||
errors3[0].StatusCode.Code.ShouldBe(StatusCodes.Good.Code);
|
||||
|
||||
await host.DisposeAsync();
|
||||
}
|
||||
@@ -246,7 +246,7 @@ public sealed class NodeManagerHistoryReadConcurrencyTests : IDisposable
|
||||
OtOpcUaSdkServer server, OtOpcUaNodeManager nm, HistoryReadDetails details, params NodeId[] nodeIds)
|
||||
{
|
||||
var context = new OperationContext(
|
||||
new RequestHeader(), secureChannelContext: null, RequestType.HistoryRead, identity: null);
|
||||
new RequestHeader(), secureChannelContext: null, RequestType.HistoryRead, requestLifetime: RequestLifetime.None, identity: null);
|
||||
|
||||
var nodesToRead = nodeIds.Select(id => new HistoryReadValueId { NodeId = id }).ToList();
|
||||
var results = Enumerable.Repeat<SdkHistoryReadResult>(null!, nodeIds.Length).ToList();
|
||||
@@ -290,7 +290,7 @@ public sealed class NodeManagerHistoryReadConcurrencyTests : IDisposable
|
||||
}
|
||||
|
||||
return new HistorianRead(
|
||||
new[] { new DataValueSnapshot(1.0f, StatusCodes.Good, DateTime.UtcNow, DateTime.UtcNow) }, null);
|
||||
new[] { new DataValueSnapshot(1.0f, StatusCodes.Good.Code, DateTime.UtcNow, DateTime.UtcNow) }, null);
|
||||
}
|
||||
|
||||
private void UpdateMax(int observed)
|
||||
@@ -384,7 +384,7 @@ public sealed class NodeManagerHistoryReadConcurrencyTests : IDisposable
|
||||
// a saturated limiter (rather than the first batch's own deadline freeing the slot early).
|
||||
await _gate.Task.ConfigureAwait(false);
|
||||
return new HistorianRead(
|
||||
new[] { new DataValueSnapshot(1.0f, StatusCodes.Good, DateTime.UtcNow, DateTime.UtcNow) }, null);
|
||||
new[] { new DataValueSnapshot(1.0f, StatusCodes.Good.Code, DateTime.UtcNow, DateTime.UtcNow) }, null);
|
||||
}
|
||||
|
||||
public Task<HistorianRead> ReadProcessedAsync(
|
||||
|
||||
Reference in New Issue
Block a user