Skip to content

Commit

Permalink
Bump to Xunit 2.9.2 (#3820)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrosswell authored Dec 4, 2024
1 parent 12f18dc commit beb05db
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ runs:
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV
echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode
- name: Pin the Xcode Version
if: runner.os == 'macOS'
shell: bash
run: sudo xcode-select --switch /Applications/Xcode_16.0.app

# Needed for Android SDK setup step
- uses: actions/setup-java@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="20.0.4" />
Expand Down
6 changes: 3 additions & 3 deletions test/Sentry.AspNetCore.Tests/SentryMiddlewareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ public void PopulateScope_DoesNotDuplicateEventProcessorsWhenPopulateMultipleTim
sut.PopulateScope(_fixture.HttpContext, scope);
sut.PopulateScope(_fixture.HttpContext, scope);

Assert.Single(scope.GetAllEventProcessors().Where(c => c == customProcessor));
Assert.Single(scope.GetAllEventProcessors(), c => c == customProcessor);
}

[Fact]
Expand Down Expand Up @@ -841,7 +841,7 @@ public void PopulateScope_DoesNotDuplicateExceptionEventProcessorsWhenPopulateMu
sut.PopulateScope(_fixture.HttpContext, scope);
sut.PopulateScope(_fixture.HttpContext, scope);

Assert.Single(scope.GetAllExceptionProcessors().Where(c => c == customEventExceptionProcessor));
Assert.Single(scope.GetAllExceptionProcessors(), c => c == customEventExceptionProcessor);
}

[Fact]
Expand Down Expand Up @@ -876,6 +876,6 @@ public void PopulateScope_DoesNotDuplicateTransactionProcessorsWhenPopulateMulti
sut.PopulateScope(_fixture.HttpContext, scope);
sut.PopulateScope(_fixture.HttpContext, scope);

Assert.Single(scope.GetAllTransactionProcessors().Where(c => c == customTransactionProcessor));
Assert.Single(scope.GetAllTransactionProcessors(), c => c == customTransactionProcessor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public void EfCoreIntegration_RunSynchronousQueryWithIssue_TransactionWithSpans(
Assert.Single(spans); //1 command
#else
Assert.Equal(2, spans.Count); //1 query compiler, 1 command
Assert.Single(spans.Where(s => s.Status == SpanStatus.Ok && s.Operation == "db.query.compile"));
Assert.Single(spans, s => s is { Status: SpanStatus.Ok, Operation: "db.query.compile" });
#endif
Assert.Single(spans.Where(s => s.Status == SpanStatus.InternalError && s.Operation == "db.query"));
Assert.Single(spans, s => s is { Status: SpanStatus.InternalError, Operation: "db.query" });
Assert.All(spans, span => Assert.True(span.IsFinished));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ public void FirstOrDefault_FromDatabase_CapturesQuery()
// This operation will result in one reading operation and two non scalar operations.
_fixture.Hub.Received(3).GetSpan();
// In-memory database doesn't have a CommandText so Description is expected to be null
Assert.NotEmpty(_fixture.Spans.Where(
span => DbNonQueryKey == span.Operation && span.Description is "CREATE SCHEMA (CodeFirstDatabase(dbo.__MigrationHistory(ContextKey(Effort.string)MigrationId(Effort.string)Model(Effort.binary)ProductVersion(Effort.string))))"));
Assert.NotEmpty(_fixture.Spans.Where(
span => DbNonQueryKey == span.Operation && span.Description is null));
Assert.NotEmpty(_fixture.Spans.Where(
span => DbReaderKey == span.Operation && span.Description is null));
Assert.Contains(_fixture.Spans,
span => DbNonQueryKey == span.Operation &&
span.Description is
"CREATE SCHEMA (CodeFirstDatabase(dbo.__MigrationHistory(ContextKey(Effort.string)MigrationId(Effort.string)Model(Effort.binary)ProductVersion(Effort.string))))");
Assert.Contains(_fixture.Spans, span => DbNonQueryKey == span.Operation && span.Description is null);
Assert.Contains(_fixture.Spans, span => DbReaderKey == span.Operation && span.Description is null);

Assert.All(_fixture.Spans, span => span.Received(1).Finish(Arg.Is<SpanStatus>(status => SpanStatus.Ok == status)));
integration.Unregister();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
<ItemGroup>
<PackageReference Include="DeviceRunners.XHarness.Maui" Version="0.1.0-preview.1" />
<PackageReference Include="DeviceRunners.XHarness.Xunit" Version="0.1.0-preview.1" />
<!-- Prevent downgrade of these packages for DeviceRunners.XHarness.Xunit 0.1.0-preview.1 -->
<PackageReference Include="System.Net.Primitives" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 8 additions & 4 deletions test/Sentry.Tests/Internals/MainExceptionProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void Process_ExceptionWithout_Handled()

sut.Process(exp, evt);

Assert.Single(evt.SentryExceptions!.Where(p => p.Mechanism?.Handled == null));
Assert.NotNull(evt.SentryExceptions);
Assert.Single(evt.SentryExceptions, p => p.Mechanism?.Handled == null);
}

[Fact]
Expand All @@ -65,7 +66,8 @@ public void Process_ExceptionWith_HandledFalse()

sut.Process(exp, evt);

Assert.Single(evt.SentryExceptions!.Where(p => p.Mechanism?.Handled == false));
Assert.NotNull(evt.SentryExceptions);
Assert.Single(evt.SentryExceptions, p => p.Mechanism?.Handled == false);
}

[Fact]
Expand All @@ -79,7 +81,8 @@ public void Process_ExceptionWith_HandledTrue()

sut.Process(exp, evt);

Assert.Single(evt.SentryExceptions!.Where(p => p.Mechanism?.Handled == true));
Assert.NotNull(evt.SentryExceptions);
Assert.Single(evt.SentryExceptions, p => p.Mechanism?.Handled == true);
}

[Fact]
Expand All @@ -91,7 +94,8 @@ public void Process_ExceptionWith_HandledTrue_WhenCaught()

sut.Process(exp, evt);

Assert.Single(evt.SentryExceptions!.Where(p => p.Mechanism?.Handled == true));
Assert.NotNull(evt.SentryExceptions);
Assert.Single(evt.SentryExceptions, p => p.Mechanism?.Handled == true);
}

[Fact]
Expand Down

0 comments on commit beb05db

Please sign in to comment.