fix(claude-do): merge Worker log: stop writing SignalR hub invocation arguments (P
ClaudeDo-Task: ae4e878c-e275-4c4f-94b5-ecb9b9602fd5
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using ClaudeDo.Worker.Logging;
|
||||
using Serilog.Events;
|
||||
using Serilog.Parsing;
|
||||
|
||||
namespace ClaudeDo.Worker.Tests.Logging;
|
||||
|
||||
public class HubLogFilterTests
|
||||
{
|
||||
private const string Dispatcher = "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher";
|
||||
|
||||
private static LogEvent Evt(string source, int eventId, string eventName, string message) => new(
|
||||
DateTimeOffset.UtcNow, LogEventLevel.Debug, null, new MessageTemplateParser().Parse(message),
|
||||
[
|
||||
new LogEventProperty("SourceContext", new ScalarValue(source)),
|
||||
new LogEventProperty("EventId", new StructureValue(
|
||||
[new LogEventProperty("Id", new ScalarValue(eventId)), new LogEventProperty("Name", new ScalarValue(eventName))])),
|
||||
]);
|
||||
|
||||
[Fact]
|
||||
public void Received_invocation_with_arguments_is_excluded()
|
||||
{
|
||||
var e = Evt(Dispatcher, 1, "ReceivedHubInvocation", "Received hub invocation: Target: SetAzureDevOpsToken, Arguments: [ secret ]");
|
||||
Assert.True(HubLogFilter.IsInvocationWithArguments(e));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Binding_failure_from_same_source_passes()
|
||||
{
|
||||
var e = Evt(Dispatcher, 3, "InvalidHubParameters", "Parameters to hub method 'X' are incorrect.");
|
||||
Assert.False(HubLogFilter.IsInvocationWithArguments(e));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Same_event_name_from_other_source_passes()
|
||||
{
|
||||
var e = Evt("Other.Source", 1, "ReceivedHubInvocation", "x");
|
||||
Assert.False(HubLogFilter.IsInvocationWithArguments(e));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user