agent: unify listening and dialing with directed mutual measurements
Replace Probe with Agent across node runtime, Fleet contracts, backend state, API and storage. Report incoming sessions and outgoing link health through each Agent uplink, and retain directed link controls and retry. Update protocol fixtures and end-to-end coverage for the unified model; accept requested cancellation during the Fleet timeout test cleanup.
This commit is contained in:
1 parent
d5ebf29e57
commit
ad5efc62ff
206 files changed
+4202
-4964
No files matched your search
@@ -57,7 +57,7 @@ public sealed class OperationsAndSecurityTests : IClassFixture<BackendFixture>
|
||||
|
||||
// 模拟“这个指标是新增的(或者它的口径变了)”:抹掉各层里已有的 rtt,并让登记的指纹对不上
|
||||
var store = Service<IMetricStore>();
|
||||
foreach (MetricRow row in await store.ReadAsync(MetricLevel.M1, agent.NodeId, "line:" + _backend.DefaultProbeId, baseMs, baseMs + (2 * Minute), default))
|
||||
foreach (MetricRow row in await store.ReadAsync(MetricLevel.M1, agent.NodeId, "line:" + _backend.DefaultDialerId, baseMs, baseMs + (2 * Minute), default))
|
||||
{
|
||||
await store.PatchAsync(MetricLevel.M1, [row with { Metrics = AccumulatorCodec.Encode(new MetricSet()) }], new HashSet<string> { "rtt" }, default);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public sealed class OperationsAndSecurityTests : IClassFixture<BackendFixture>
|
||||
Assert.Equal("fleet_protocol_violation", (await agent.RequestRawAsync(MoShiroMethods.TestRun)).Error!.Data!.Code);
|
||||
Assert.Equal("fleet_protocol_violation", (await agent.RequestRawAsync("fleet.state.sync")).Error!.Data!.Code);
|
||||
|
||||
// 一个 Probe 都不是的 Agent 发 Probe 才有的通道:节点面的列块通道(17)没有声明,不会进收件箱
|
||||
// Agent 向 Backend 发送仅用于节点对等会话的列块通道(17):节点面未声明此方向,不会进入收件箱
|
||||
await agent.SendBinaryAsync(OutboxFrame.Build(MoShiroChannels.ColumnBlock, Guid.NewGuid(), [1]));
|
||||
|
||||
// 反复违规:超过上限(默认 20 次)之后连接被服务端关闭
|
||||
@@ -226,10 +226,10 @@ public sealed class OperationsAndSecurityTests : IClassFixture<BackendFixture>
|
||||
{
|
||||
await using AgentSimulator agent = await _backend.ConnectAgentAsync(autoApprove: false);
|
||||
// 状态与事件也不会被接受:监控数据里没有它
|
||||
await agent.SendEventAsync(AgentEventKinds.ProbeConnected, _backend.DefaultProbeId);
|
||||
await agent.SendEventAsync(AgentEventKinds.DialerConnected, _backend.DefaultDialerId);
|
||||
await Task.Delay(200);
|
||||
JsonNode view = await _backend.GetJsonAsync(_backend.Admin, "/api/admin/agents/" + agent.NodeId.Value);
|
||||
Assert.False(view["probe_connected"]!.GetValue<bool>());
|
||||
Assert.False(view["dialer_connected"]!.GetValue<bool>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user