diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.Host.Tests/Configuration/HistorianBackendRegistryTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.Host.Tests/Configuration/HistorianBackendRegistryTests.cs index b276067b..21f9eb95 100644 --- a/tests/Server/ZB.MOM.WW.OtOpcUa.Host.Tests/Configuration/HistorianBackendRegistryTests.cs +++ b/tests/Server/ZB.MOM.WW.OtOpcUa.Host.Tests/Configuration/HistorianBackendRegistryTests.cs @@ -149,15 +149,24 @@ public sealed class HistorianBackendRegistryTests IHistorianDataSource Source(ServerHistorianOptions o, IConfiguration c) => HistorianBackendRegistry.Resolve(o, c).CreateDataSource(sp); - // #681: the ten per-sample aggregates (raw-evaluated) + the two AVEVA-native ones. - Source(Gateway(), Cfg).SupportedAggregates.ShouldBe( - [ - HistoryAggregateType.Average, HistoryAggregateType.Count, HistoryAggregateType.Minimum, - HistoryAggregateType.Maximum, HistoryAggregateType.Range, HistoryAggregateType.Start, HistoryAggregateType.End, - HistoryAggregateType.Delta, HistoryAggregateType.MinimumActualTime, HistoryAggregateType.MaximumActualTime, - HistoryAggregateType.TimeAverage, HistoryAggregateType.Total, - ], - ignoreOrder: true); + // #681: the ten per-sample aggregates (raw-evaluated). The two AVEVA-native ones (TimeAverage / Total) are + // refused and not advertised by default until historiangw#27 is fixed (#746, R08:2.1) ... + HistoryAggregateType[] gatewayRawEvaluated = + [ + HistoryAggregateType.Average, HistoryAggregateType.Count, HistoryAggregateType.Minimum, + HistoryAggregateType.Maximum, HistoryAggregateType.Range, HistoryAggregateType.Start, HistoryAggregateType.End, + HistoryAggregateType.Delta, HistoryAggregateType.MinimumActualTime, HistoryAggregateType.MaximumActualTime, + ]; + Source(Gateway(), Cfg).SupportedAggregates.ShouldBe(gatewayRawEvaluated, ignoreOrder: true); + + // ... and served again, through the Host's resolve path, once ServerHistorian:Gateway:EnableNativeTimeWeighted is on. + var nativeOn = new ServerHistorianOptions + { + Backend = "Gateway", Enabled = true, Endpoint = "http://localhost:5222", ApiKey = "histgw_id_secret", UseTls = false, + Gateway = new GatewayHistorianSettings { EnableNativeTimeWeighted = true }, + }; + Source(nativeOn, Cfg).SupportedAggregates.ShouldBe( + [.. gatewayRawEvaluated, HistoryAggregateType.TimeAverage, HistoryAggregateType.Total], ignoreOrder: true); Source(new ServerHistorianOptions { Backend = "SqlServer", Enabled = true }, SqlCfg()) .SupportedAggregates.ShouldBe(SqlServed, ignoreOrder: true); Source(new ServerHistorianOptions { Backend = "QuestDb", Enabled = true }, QuestDbCfg())