-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MongoDB.Driver version 3 made a major breaking change by removing the…
… MongoDB.Driver.Core assembly. Handle this breaking change by splitting our package into 2, one for each major version. 1. For the current HealthChecks.MongoDb package, we put a NuGet version limit on our dependency: [2.28.0,3.0.0). This way people won't be able to update to the 3.0.0 version, which will break their app. 2. We add a new, forked component named HealthChecks.MongoDb.v3 which will have a dependency on 3.0.0 and contains updates so the health checks will work with v3. People who explicitly want to use version 3 can opt into using this package. 3. When the next major version of HealthChecks ships, we can "swap" the dependencies around. The HealthChecks.MongoDb package will be updated to depend on version 3 of MongoDB.Driver. If MongoDB.Driver v2.x is still in support, we can create HeatlhChecks.MongoDb.v2 which has the dependency limit [2.28.0,3.0.0) and works with the version 2 of MongoDB.Driver. HealthChecks.MongoDb.v3 will be dead-ended. Fix #2322
- Loading branch information
Showing
7 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/HealthChecks.MongoDb.v3/HealthChecks.MongoDb.v3.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<!-- Match the TFMs of MongoDB.Driver --> | ||
<TargetFrameworks>$(DefaultNetCoreApp);netstandard2.1;net472</TargetFrameworks> | ||
<PackageTags>$(PackageTags);MongoDb</PackageTags> | ||
<Description>HealthChecks.MongoDb is the health check package for MongoDb (version 3+).</Description> | ||
<VersionPrefix>$(HealthCheckMongoDB)</VersionPrefix> | ||
<AssemblyName>HealthChecks.MongoDb</AssemblyName> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MongoDB.Driver" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.0" /> | ||
|
||
<Compile Include="../HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs" Link="DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs" /> | ||
<Compile Include="../HealthChecks.MongoDb/MongoDbHealthCheck.cs" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
test/HealthChecks.MongoDb.v3.Tests/HealthChecks.MongoDb.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace HealthChecks.MongoDb | ||
{ | ||
public class MongoDbHealthCheck : Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck | ||
{ | ||
public MongoDbHealthCheck(MongoDB.Driver.IMongoClient client, string? databaseName = null) { } | ||
public MongoDbHealthCheck(MongoDB.Driver.MongoClientSettings clientSettings, string? databaseName = null) { } | ||
public MongoDbHealthCheck(string connectionString, string? databaseName = null) { } | ||
public System.Threading.Tasks.Task<Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult> CheckHealthAsync(Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckContext context, System.Threading.CancellationToken cancellationToken = default) { } | ||
} | ||
} | ||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
public static class MongoDbHealthCheckBuilderExtensions | ||
{ | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, MongoDB.Driver.MongoClientSettings mongoClientSettings, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = null, System.TimeSpan? timeout = default) { } | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func<System.IServiceProvider, MongoDB.Driver.IMongoClient> mongoClientFactory, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = null, System.TimeSpan? timeout = default) { } | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func<System.IServiceProvider, string> mongodbConnectionStringFactory, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = null, System.TimeSpan? timeout = default) { } | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string mongodbConnectionString, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = null, System.TimeSpan? timeout = default) { } | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, MongoDB.Driver.MongoClientSettings mongoClientSettings, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = null, System.TimeSpan? timeout = default) { } | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func<System.IServiceProvider, MongoDB.Driver.IMongoClient> mongoClientFactory, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = null, System.TimeSpan? timeout = default) { } | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func<System.IServiceProvider, string> mongodbConnectionStringFactory, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = null, System.TimeSpan? timeout = default) { } | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string mongodbConnectionString, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = null, System.TimeSpan? timeout = default) { } | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
test/HealthChecks.MongoDb.v3.Tests/HealthChecks.MongoDb.v3.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>HealthChecks.MongoDb.Tests</AssemblyName> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\HealthChecks.MongoDb.v3\HealthChecks.MongoDb.v3.csproj" /> | ||
|
||
<Compile Include="../HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs" Link="DependencyInjection/RegistrationTests.cs" /> | ||
<Compile Include="../HealthChecks.MongoDb.Tests/Functional/MongoDbHealthCheckTests.cs" Link="Functional/MongoDbHealthCheckTests.cs" /> | ||
</ItemGroup> | ||
|
||
</Project> |