Issue #21: implement worker bootstrap and options
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using MxGateway.Worker.Bootstrap;
|
||||
|
||||
namespace MxGateway.Worker.Tests.Bootstrap;
|
||||
|
||||
public sealed class WorkerConsoleLoggerTests
|
||||
{
|
||||
[Fact]
|
||||
public void Information_RedactsNonceInStructuredOutput()
|
||||
{
|
||||
StringWriter writer = new();
|
||||
WorkerConsoleLogger logger = new(writer);
|
||||
|
||||
logger.Information("WorkerBootstrapSucceeded", new Dictionary<string, object?>
|
||||
{
|
||||
["session_id"] = "session-1",
|
||||
["nonce"] = "nonce-secret",
|
||||
});
|
||||
|
||||
string output = writer.ToString();
|
||||
|
||||
Assert.Contains("event=WorkerBootstrapSucceeded", output);
|
||||
Assert.Contains("session_id=session-1", output);
|
||||
Assert.Contains("nonce=[redacted]", output);
|
||||
Assert.DoesNotContain("nonce-secret", output);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user