513fa1aa16
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
78 lines
3.3 KiB
C#
78 lines
3.3 KiB
C#
namespace ZB.MOM.WW.ScadaBridge.Communication.Tests;
|
|
|
|
/// <summary>
|
|
/// Tests for per-pattern timeout configuration.
|
|
/// </summary>
|
|
public class CommunicationOptionsTests
|
|
{
|
|
/// <summary>Verifies that the default timeouts are reasonable.</summary>
|
|
[Fact]
|
|
public void DefaultTimeouts_AreReasonable()
|
|
{
|
|
var options = new CommunicationOptions();
|
|
|
|
Assert.Equal(TimeSpan.FromMinutes(2), options.DeploymentTimeout);
|
|
Assert.Equal(TimeSpan.FromSeconds(30), options.LifecycleTimeout);
|
|
Assert.Equal(TimeSpan.FromMinutes(1), options.ArtifactDeploymentTimeout);
|
|
Assert.Equal(TimeSpan.FromSeconds(30), options.QueryTimeout);
|
|
Assert.Equal(TimeSpan.FromSeconds(30), options.IntegrationTimeout);
|
|
Assert.Equal(TimeSpan.FromSeconds(10), options.DebugViewTimeout);
|
|
Assert.Equal(TimeSpan.FromSeconds(10), options.HealthReportTimeout);
|
|
}
|
|
|
|
/// <summary>Verifies that the transport heartbeat has explicit defaults.</summary>
|
|
[Fact]
|
|
public void TransportHeartbeat_HasExplicitDefaults()
|
|
{
|
|
var options = new CommunicationOptions();
|
|
|
|
// Transport heartbeat is explicitly configured, not framework defaults
|
|
Assert.Equal(TimeSpan.FromSeconds(5), options.TransportHeartbeatInterval);
|
|
Assert.Equal(TimeSpan.FromSeconds(15), options.TransportFailureThreshold);
|
|
}
|
|
|
|
/// <summary>Verifies that the deployment timeout is the longest of the timeout patterns.</summary>
|
|
[Fact]
|
|
public void DeploymentTimeout_IsLongestPattern()
|
|
{
|
|
var options = new CommunicationOptions();
|
|
|
|
Assert.True(options.DeploymentTimeout > options.LifecycleTimeout);
|
|
Assert.True(options.DeploymentTimeout > options.QueryTimeout);
|
|
Assert.True(options.DeploymentTimeout > options.IntegrationTimeout);
|
|
}
|
|
|
|
/// <summary>Verifies that all timeouts are configurable.</summary>
|
|
[Fact]
|
|
public void AllTimeouts_AreConfigurable()
|
|
{
|
|
var options = new CommunicationOptions
|
|
{
|
|
DeploymentTimeout = TimeSpan.FromMinutes(5),
|
|
LifecycleTimeout = TimeSpan.FromMinutes(1),
|
|
ArtifactDeploymentTimeout = TimeSpan.FromMinutes(3),
|
|
QueryTimeout = TimeSpan.FromMinutes(1),
|
|
IntegrationTimeout = TimeSpan.FromMinutes(1),
|
|
DebugViewTimeout = TimeSpan.FromSeconds(30),
|
|
HealthReportTimeout = TimeSpan.FromSeconds(30),
|
|
TransportHeartbeatInterval = TimeSpan.FromSeconds(2),
|
|
TransportFailureThreshold = TimeSpan.FromSeconds(10)
|
|
};
|
|
|
|
Assert.Equal(TimeSpan.FromMinutes(5), options.DeploymentTimeout);
|
|
Assert.Equal(TimeSpan.FromSeconds(2), options.TransportHeartbeatInterval);
|
|
}
|
|
|
|
/// <summary>Verifies that the application heartbeat interval defaults to 5 seconds, independent of the transport heartbeat.</summary>
|
|
[Fact]
|
|
public void ApplicationHeartbeatInterval_DefaultsTo5s_IndependentOfTransport()
|
|
{
|
|
var o = new CommunicationOptions();
|
|
Assert.Equal(TimeSpan.FromSeconds(5), o.ApplicationHeartbeatInterval);
|
|
// Retuning the Akka.Remote failure-detector heartbeat must NOT silently
|
|
// retune the application-level site→central health heartbeat.
|
|
o.TransportHeartbeatInterval = TimeSpan.FromSeconds(30);
|
|
Assert.Equal(TimeSpan.FromSeconds(5), o.ApplicationHeartbeatInterval);
|
|
}
|
|
}
|