feat(mtconnect): warn at Test Connect and deploy when SampleCount >= the Agent bufferSize (#825)
Parse the /probe Header bufferSize; MTConnectDriverProbe reads sampleCount (default 1000) and answers Ok with a WARNING message (amber chip in the Test Connect button); InitializeAsync logs the same Warning and exposes agentBufferSize on the diagnostics bag. Live-checked against the shared cppagent fixture (bufferSize 16384).
This commit is contained in:
+29
@@ -947,6 +947,35 @@ public sealed class MTConnectAgentIntegrationTests(MTConnectAgentFixture agent)
|
||||
seen.Skip(before).ShouldContain(e => e.Snapshot.StatusCode == Good);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #825 — Test Connect reads the live Agent's <c>/probe</c> <c>bufferSize</c> and warns (still Ok) when the
|
||||
/// configured <c>SampleCount</c> would be refused; one below the buffer is the falsifiability control.
|
||||
/// </summary>
|
||||
[Fact(Timeout = TestTimeoutMs)]
|
||||
public async Task Test_Connect_warns_when_SampleCount_reaches_the_live_agents_buffer_size()
|
||||
{
|
||||
SkipIfDown();
|
||||
|
||||
var bufferSize = (int?)agent.ProbeDocument?.Root?.Elements().FirstOrDefault(e => e.Name.LocalName == "Header")
|
||||
?.Attribute("bufferSize");
|
||||
if (bufferSize is not > 1)
|
||||
{
|
||||
Assert.Skip($"The Agent at {agent.AgentUri} declares no usable bufferSize in its /probe header.");
|
||||
}
|
||||
|
||||
var refused = await new MTConnectDriverProbe().ProbeAsync(
|
||||
JsonSerializer.Serialize(new { agentUri = agent.AgentUri, sampleCount = bufferSize.Value }),
|
||||
TimeSpan.FromSeconds(15), Ct);
|
||||
refused.Ok.ShouldBeTrue(refused.Message);
|
||||
refused.Message!.ShouldContain($"WARNING: SampleCount {bufferSize.Value} is at or above the Agent's bufferSize {bufferSize.Value}");
|
||||
|
||||
var fits = await new MTConnectDriverProbe().ProbeAsync(
|
||||
JsonSerializer.Serialize(new { agentUri = agent.AgentUri, sampleCount = bufferSize.Value - 1 }),
|
||||
TimeSpan.FromSeconds(15), Ct);
|
||||
fits.Ok.ShouldBeTrue(fits.Message);
|
||||
fits.Message!.ShouldNotContain("WARNING");
|
||||
}
|
||||
|
||||
private static bool Is(string? value, string expected) =>
|
||||
string.Equals(value?.Trim(), expected, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user