[CI] [SKIP TESTS] Add detailed Probe-Agent connection diagnostics
This commit is contained in:
1 parent
0fd38b2367
commit
a7ebf61551
16 files changed
+376
-51
No files matched your search
@@ -0,0 +1,27 @@
|
||||
using Fleet.Core;
|
||||
using MoShiro.Backend.Application;
|
||||
using MoShiro.Protocol;
|
||||
|
||||
namespace MoShiro.Backend.Tests;
|
||||
|
||||
public sealed class NodeRuntimeLogTests
|
||||
{
|
||||
[Fact]
|
||||
public void DiagnosticFieldsSurviveUpload_WhileSecretsAndOversizedFieldsRemainBounded()
|
||||
{
|
||||
var service = new NodeRuntimeLogService(TimeProvider.System);
|
||||
var node = new NodeId("prb_diagnostics");
|
||||
Dictionary<string, string> fields = Enumerable.Range(0, 18).ToDictionary(i => "field_" + i, _ => "value");
|
||||
fields.Add("api_token", "must-not-survive");
|
||||
fields.Add("detail", new string('x', 500));
|
||||
fields.Add("overflow", "discard");
|
||||
service.Append(node, [new NodeLogRecord(TimeProvider.System.GetUtcNow().ToUnixTimeMilliseconds(), "warn", "handshake failed", fields)], 0);
|
||||
|
||||
NodeRuntimeLog entry = Assert.Single(service.List(node, 10).Items);
|
||||
Assert.Equal(20, entry.Fields.Count);
|
||||
Assert.Equal("value", entry.Fields["field_17"]);
|
||||
Assert.Equal("[redacted]", entry.Fields["api_token"]);
|
||||
Assert.Equal(128, entry.Fields["detail"].Length);
|
||||
Assert.False(entry.Fields.ContainsKey("overflow"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user