Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: move to static VerifierSettings #3684

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public Task Populate_RouteData_SetToScope()
// Act
_sut.Populate(_httpContext, SentryAspNetCoreOptions);

return Verify(_sut)
.IgnoreStandardSentryMembers();
return Verify(_sut);
}
}
2 changes: 0 additions & 2 deletions test/Sentry.AspNetCore.Tests/WebIntegrationTests.verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public async Task Versioning()
server.Dispose();

await Verify(new { result, transport.Payloads })
.IgnoreStandardSentryMembers()
.ScrubAspMembers()
.UniqueForTargetFrameworkAndVersion();
}
Expand Down Expand Up @@ -136,7 +135,6 @@ public async Task PreFlightIgnoresTransaction()
server.Dispose();

await Verify(new { result, transport.Payloads })
.IgnoreStandardSentryMembers()
.ScrubAspMembers();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public async Task RecordsSqlAsync()
}

var result = await Verify(transport.Payloads)
.IgnoreMember<IEventLike>(_ => _.Environment)
.IgnoreStandardSentryMembers();
.IgnoreMember<IEventLike>(_ => _.Environment);
Assert.DoesNotContain("SHOULD NOT APPEAR IN PAYLOAD", result.Text);
}
#endif
Expand Down Expand Up @@ -138,7 +137,6 @@ void ApplyOptions(SentryLoggingOptions sentryOptions)
var efVersion = typeof(DbContext).Assembly.GetName().Version!.ToString(3);
return line.Replace(efVersion, "");
})
.IgnoreStandardSentryMembers()
.UniqueForRuntimeAndVersion();
Assert.DoesNotContain("An error occurred while saving the entity changes", result.Text);
}
Expand Down Expand Up @@ -214,7 +212,6 @@ public async Task RecordsEfAsync()

var result = await Verify(transport.Payloads)
.IgnoreMember<IEventLike>(_ => _.Environment)
.IgnoreStandardSentryMembers()
.UniqueForRuntimeAndVersion();
Assert.DoesNotContain("SHOULD NOT APPEAR IN PAYLOAD", result.Text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ await database.Context.TestTable
}
}

var result = await Verify(transport.Payloads)
.IgnoreStandardSentryMembers();
var result = await Verify(transport.Payloads);
Assert.DoesNotContain(shouldNotAppearInPayload, result.Text);
options.DisableDbInterceptionIntegration();
}
Expand Down
2 changes: 0 additions & 2 deletions test/Sentry.Log4Net.Tests/IntegrationTests.verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public async Task Simple()
}

await Verify(transport.Envelopes)
.IgnoreStandardSentryMembers()
.IgnoreMembers("ThreadName", "Domain", "Extra");
}

Expand Down Expand Up @@ -82,7 +81,6 @@ await Verify(
transport.Envelopes,
warningsAndAbove
})
.IgnoreStandardSentryMembers()
.IgnoreMembers("ThreadName", "Domain", "Extra");
Assert.Empty(warningsAndAbove);
}
Expand Down
6 changes: 2 additions & 4 deletions test/Sentry.NLog.Tests/IntegrationTests.verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public Task Simple()
LogManager.Flush();

return Verify(transport.Envelopes)
.UniqueForRuntimeAndVersion()
.IgnoreStandardSentryMembers();
.UniqueForRuntimeAndVersion();
}

[Fact]
Expand Down Expand Up @@ -99,7 +98,6 @@ public Task LoggingInsideTheContextOfLogging()
.Entries
.Where(_ => _.Level == SentryLevel.Error),
transport.Envelopes
})
.IgnoreStandardSentryMembers();
});
}
}
6 changes: 2 additions & 4 deletions test/Sentry.Serilog.Tests/IntegrationTests.verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public Task Simple()
Log.CloseAndFlush();

return Verify(transport.Envelopes)
.UniqueForRuntimeAndVersion()
.IgnoreStandardSentryMembers();
.UniqueForRuntimeAndVersion();
}

[Fact]
Expand Down Expand Up @@ -98,8 +97,7 @@ public Task LoggingInsideTheContextOfLogging()
.Entries
.Where(_ => _.Level == SentryLevel.Error),
transport.Envelopes
})
.IgnoreStandardSentryMembers();
});
}
}
#endif
64 changes: 32 additions & 32 deletions test/Sentry.Testing/VerifyExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ namespace Sentry.Testing;

public static class VerifyExtensions
{
public static SettingsTask IgnoreStandardSentryMembers(this SettingsTask settings)
[ModuleInitializer]
public static void Initialize()
{
return settings
.ScrubMachineName()
.ScrubUserName()
.AddExtraSettings(_ =>
{
_.Converters.Add(new SpansConverter());
_.Converters.Add(new ContextsConverter());
_.Converters.Add(new DebugImageConverter());
_.Converters.Add(new StackFrameConverter());
})
.IgnoreMembers("version", "elapsed")
.IgnoreMembersWithType<SdkVersion>()
.IgnoreMembersWithType<DateTimeOffset>()
.IgnoreMembersWithType<SpanId>()
.IgnoreMembersWithType<SentryId>()
.IgnoreMembers<SentryEvent>(
_ => _.Modules,
_ => _.Release)
.IgnoreMembers<SentryRequest>(
_ => _.Env,
_ => _.Url,
_ => _.Headers)
.IgnoreMembers<SessionUpdate>(
_ => _.Duration)
.IgnoreMembers<SentryTransaction>(
_ => _.Release)
.IgnoreMembers<SentryException>(
_ => _.Module,
_ => _.ThreadId)
.IgnoreMembers<SentryThread>(_ => _.Id)
.IgnoreStackTrace();
VerifierSettings.ScrubMachineName();
VerifierSettings.ScrubUserName();
VerifierSettings.AddExtraSettings(_ =>
{
_.Converters.Add(new SpansConverter());
_.Converters.Add(new ContextsConverter());
_.Converters.Add(new DebugImageConverter());
_.Converters.Add(new StackFrameConverter());
});
VerifierSettings.IgnoreMembers("version", "elapsed");
VerifierSettings.IgnoreMembersWithType<SdkVersion>();
VerifierSettings.IgnoreMembersWithType<DateTimeOffset>();
VerifierSettings.IgnoreMembersWithType<SpanId>();
VerifierSettings.IgnoreMembersWithType<SentryId>();
VerifierSettings.IgnoreMembers<SentryEvent>(
_ => _.Modules,
_ => _.Release);
VerifierSettings.IgnoreMembers<SentryRequest>(
_ => _.Env,
_ => _.Url,
_ => _.Headers);
VerifierSettings.IgnoreMembers<SessionUpdate>(
_ => _.Duration);
VerifierSettings.IgnoreMembers<SentryTransaction>(
_ => _.Release);
VerifierSettings.IgnoreMembers<SentryException>(
_ => _.Module,
_ => _.ThreadId);
VerifierSettings.IgnoreMembers<SentryThread>(_ => _.Id);
VerifierSettings.IgnoreStackTrace();
}

private class SpansConverter : WriteOnlyJsonConverter<IReadOnlyCollection<SentrySpan>>
Expand Down
9 changes: 3 additions & 6 deletions test/Sentry.Tests/EventProcessorTests.verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public async Task Simple()
await hub.FlushAsync();
}

await Verify(transport.Envelopes)
.IgnoreStandardSentryMembers();
await Verify(transport.Envelopes);
}

[Fact]
Expand All @@ -43,8 +42,7 @@ public async Task WithTransaction()
await hub.FlushAsync();
}

await Verify(transport.Envelopes)
.IgnoreStandardSentryMembers();
await Verify(transport.Envelopes);
}

public class TheEventProcessor : ISentryEventProcessor
Expand All @@ -69,8 +67,7 @@ public async Task Discard()
await hub.FlushAsync();
}

await Verify(transport.Envelopes)
.IgnoreStandardSentryMembers();
await Verify(transport.Envelopes);
}

public class DiscardEventProcessor : ISentryEventProcessor
Expand Down
1 change: 0 additions & 1 deletion test/Sentry.Tests/HubTests.verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public async Task CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEn

await Verify(worker.Envelopes)
.UniqueForRuntimeAndVersion()
.IgnoreStandardSentryMembers()
.IgnoreMember("Stacktrace")
.IgnoreMember<SentryThread>(_ => _.Name)
.IgnoreInstance<DebugImage>(_ =>
Expand Down
6 changes: 2 additions & 4 deletions test/Sentry.Tests/TransactionProcessorTests.verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public async Task Simple()
await hub.FlushAsync();
}

await Verify(transport.Envelopes)
.IgnoreStandardSentryMembers();
await Verify(transport.Envelopes);
}

[Fact]
Expand All @@ -41,7 +40,6 @@ public async Task Discard()
await hub.FlushAsync();
}

await Verify(transport.Envelopes)
.IgnoreStandardSentryMembers();
await Verify(transport.Envelopes);
}
}
Loading