Verify snapshot test writes all frameworks to single file

47 views Asked by At

It's is probably specific to how Verify runs on this repo and I'm familiar:

A snapshot test runs for different frameworks (net6.0, net7.0) and works fine. I've added net8.0 and it now fails because 1 HTTP request recorded includes an extra - to it:

-             Message: Request starting HTTP/1.1 GET http://localhost/v1.1/Target - -,
+             Message: Request starting HTTP/1.1 GET http://localhost/v1.1/Target - - -,

I see a single file (instead of a file named by TMF):

        modified:   ../../test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.verified.txt

no changes added to commit (use "git add" and/or "git commit -a")
bruno@DHPKTVF22X Sentry % git diff
diff --git a/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.verified.txt b/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.verified.txt
index 9abeb130..d9449e1f 100644
--- a/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.verified.txt
+++ b/test/Sentry.AspNetCore.Tests/WebIntegrationTests.Versioning.verified.txt
@@ -27,7 +27,7 @@
         Environment: production,
         Breadcrumbs: [
           {
-            Message: Request starting HTTP/1.1 GET http://localhost/v1.1/Target - - -,
+            Message: Request starting HTTP/1.1 GET http://localhost/v1.1/Target - -,
             Data: {
               eventId: 1
             },

I guess I could ignore this from the snapshot. Or perhaps want to have a separate file for TFM?

I'm not sure how to achieve either so help appreciated.

Repro in this PR: https://github.com/getsentry/sentry-dotnet/pull/2791

The test (has some methods specific to this project):



    [Fact]
    public async Task Versioning()
    {
        // Arrange
        var transport = new RecordingTransport();
        using var server = new TestServer(
            new WebHostBuilder()
                .UseSentry(o =>
                {
                    o.Dsn = ValidDsn;
                    o.TracesSampleRate = 1;
                    o.Transport = transport;
                    o.Debug = true;
                    o.DiagnosticLogger = _logger;

                    // Disable process exit flush to resolve "There is no currently active test." errors.
                    o.DisableAppDomainProcessExitFlush();
                })
                .ConfigureServices(services =>
                {
                    services.AddRouting();

                    var controllers = services.AddControllers();
                    controllers.UseSpecificControllers(typeof(VersionController));

                    services.AddApiVersioning(versioningOptions =>
                    {
                        versioningOptions.DefaultApiVersion = new ApiVersion(1, 0);
                        versioningOptions.AssumeDefaultVersionWhenUnspecified = true;
                        versioningOptions.ReportApiVersions = true;
                    });
                })
                .Configure(app =>
                {
                    app.UseRouting();
                    app.UseEndpoints(routeBuilder => routeBuilder.MapControllers());
                }));

        var client = server.CreateClient();

        // Act
        var result = await client.GetStringAsync("/v1.1/Target");

        // dispose will ultimately trigger the background worker to flush
        server.Dispose();

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

There are 0 answers