fix(audit-log): explicit long CommandTimeout on partition-switch and per-channel purge maintenance paths
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using ZB.MOM.WW.ScadaBridge.AuditLog.Central;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Central;
|
||||
|
||||
/// <summary>
|
||||
/// Task 4 tests for <see cref="AuditLogPurgeOptions.MaintenanceCommandTimeoutMinutes"/> /
|
||||
/// <see cref="AuditLogPurgeOptions.ResolvedMaintenanceCommandTimeout"/>: the maintenance timeout
|
||||
/// defaults to 30 minutes and is clamped to a 1-minute floor so a misconfigured 0/negative value
|
||||
/// cannot yield a zero/negative ADO.NET command timeout (arch-review 04, S2).
|
||||
/// </summary>
|
||||
public class AuditLogPurgeOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void MaintenanceCommandTimeout_Defaults_To_30_Minutes()
|
||||
{
|
||||
var options = new AuditLogPurgeOptions();
|
||||
Assert.Equal(30, options.MaintenanceCommandTimeoutMinutes);
|
||||
Assert.Equal(TimeSpan.FromMinutes(30), options.ResolvedMaintenanceCommandTimeout);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0, 1)] // clamp floor — a zero config value cannot become a zero timeout
|
||||
[InlineData(-5, 1)] // clamp floor — negatives are rejected by ADO.NET
|
||||
[InlineData(1, 1)] // boundary passthrough
|
||||
[InlineData(45, 45)] // ordinary passthrough
|
||||
public void ResolvedMaintenanceCommandTimeout_Clamps_To_MinimumOneMinute(int configured, int expectedMinutes)
|
||||
{
|
||||
var options = new AuditLogPurgeOptions { MaintenanceCommandTimeoutMinutes = configured };
|
||||
Assert.Equal(TimeSpan.FromMinutes(expectedMinutes), options.ResolvedMaintenanceCommandTimeout);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user