fix(historian): respect gateway ceilings and history value contracts
v2-ci / build (pull_request) Successful in 5m10s
v2-ci / unit-tests (pull_request) Failing after 28m34s

This commit is contained in:
Joseph Doherty
2026-10-13 03:51:04 -04:00
parent 66a2b0c3e9
commit 97668d26d3
15 changed files with 474 additions and 29 deletions
@@ -11,6 +11,33 @@ public sealed class SqlServerHistorianProviderTests
ConnectionString = "Server=localhost;User Id=sa;Password=x;TrustServerCertificate=True",
});
[Theory]
[InlineData("Raw")]
[InlineData("AtTime")]
[InlineData("Processed")]
[InlineData("Events")]
[InlineData("Modified")]
public async Task A_connection_failure_is_exposed_as_a_transport_failure(string kind)
{
var provider = new SqlServerHistorianProvider(new SqlServerHistorianOptions {
ConnectionString = "Server=127.0.0.1,1;User Id=sa;Password=test;TrustServerCertificate=True;Connect Timeout=1;ConnectRetryCount=0;Pooling=False", AutoCreateSchema = false
});
using var source = provider.CreateDataSource(new NullSp());
var t = new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Func<Task> read = kind switch
{
"Raw" => async () => await source.ReadRawAsync("T", t, t.AddHours(1), 10, TestContext.Current.CancellationToken),
"AtTime" => async () => await source.ReadAtTimeAsync("T", [t], TestContext.Current.CancellationToken),
"Processed" => async () => await source.ReadProcessedAsync("T", t, t.AddHours(1), TimeSpan.FromSeconds(10), HistoryAggregateType.Average, TestContext.Current.CancellationToken),
"Events" => async () => await source.ReadEventsAsync("T", t, t.AddHours(1), 10, TestContext.Current.CancellationToken),
_ => async () => await source.ReadModifiedAsync("T", t, t.AddHours(1), 10, null, TestContext.Current.CancellationToken)
};
var error = await Should.ThrowAsync<System.IO.IOException>(read);
error.InnerException.ShouldNotBeNull();
// A cached bootstrap outage must remain retryable on subsequent reads as well.
(await Should.ThrowAsync<System.IO.IOException>(read)).InnerException.ShouldNotBeNull();
}
[Fact]
public void Name_and_all_six_kinds()
{