Skip to content

Commit 8caad3f

Browse files
committed
test: remove obsolete health check test for pre-cancelled token
1 parent 7afe43f commit 8caad3f

1 file changed

Lines changed: 0 additions & 20 deletions

File tree

test/Kista.XUnit/Unit/HealthChecks/RepositoryHealthCheckBaseTests.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,6 @@ public async Task CheckHealthAsync_WithShortTimeout_ReturnsUnhealthy()
7777
// Assert
7878
Assert.Equal(HealthStatus.Unhealthy, result.Status);
7979
}
80-
81-
[Fact]
82-
public async Task CheckHealthAsync_WithPreCancelledToken_ReturnsUnhealthy()
83-
{
84-
// Arrange
85-
var healthCheck = new SlowTestHealthCheck(TimeSpan.FromSeconds(10));
86-
var context = new HealthCheckContext
87-
{
88-
Registration = new HealthCheckRegistration("Test", new DelegatedHealthCheck2(), HealthStatus.Unhealthy, null, TimeSpan.FromSeconds(30))
89-
};
90-
var services = new ServiceCollection().BuildServiceProvider();
91-
var cts = new CancellationTokenSource();
92-
cts.Cancel();
93-
94-
// Act - When token is already cancelled, health check should return Unhealthy
95-
var result = await healthCheck.CheckHealthAsync(context, services, cts.Token);
96-
97-
// Assert - Should return unhealthy, not throw (exception is caught and converted to result)
98-
Assert.Equal(HealthStatus.Unhealthy, result.Status);
99-
}
10080

10181
private class DelegatedHealthCheck2 : IHealthCheck
10282
{

0 commit comments

Comments
 (0)