From d6241bafa5084321dda7f69a6d74e2061ab12009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20St=C3=BChmer?= Date: Tue, 17 Dec 2024 11:59:00 +0100 Subject: [PATCH] feat: Azure CosmosDB package Closes: #35 --- Directory.Packages.props | 2 ++ HealthChecks.sln | 15 +++++++++++++ .../Class1.cs | 3 +++ ...NetEvolve.HealthChecks.Azure.Cosmos.csproj | 22 +++++++++++++++++++ .../Azure/Cosmos/CosmosDbContainer.cs | 18 +++++++++++++++ ...olve.HealthChecks.Tests.Integration.csproj | 1 + 6 files changed, 61 insertions(+) create mode 100644 src/NetEvolve.HealthChecks.Azure.Cosmos/Class1.cs create mode 100644 src/NetEvolve.HealthChecks.Azure.Cosmos/NetEvolve.HealthChecks.Azure.Cosmos.csproj create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/Azure/Cosmos/CosmosDbContainer.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index 6754c03..1d9cfae 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,6 +24,7 @@ + @@ -43,6 +44,7 @@ + diff --git a/HealthChecks.sln b/HealthChecks.sln index 4bd8157..f2d88c5 100644 --- a/HealthChecks.sln +++ b/HealthChecks.sln @@ -65,6 +65,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetEvolve.HealthChecks.Test EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetEvolve.HealthChecks.Tests.Architecture", "tests\NetEvolve.HealthChecks.Tests.Architecture\NetEvolve.HealthChecks.Tests.Architecture.csproj", "{17BCA132-1FBB-46C1-B6A1-60F64969383D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetEvolve.HealthChecks.Azure.Cosmos", "src\NetEvolve.HealthChecks.Azure.Cosmos\NetEvolve.HealthChecks.Azure.Cosmos.csproj", "{0014110E-EC85-4D97-BFC4-D1485511B4C1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -315,6 +317,18 @@ Global {17BCA132-1FBB-46C1-B6A1-60F64969383D}.Release|x64.Build.0 = Release|Any CPU {17BCA132-1FBB-46C1-B6A1-60F64969383D}.Release|x86.ActiveCfg = Release|Any CPU {17BCA132-1FBB-46C1-B6A1-60F64969383D}.Release|x86.Build.0 = Release|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Debug|x64.ActiveCfg = Debug|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Debug|x64.Build.0 = Debug|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Debug|x86.ActiveCfg = Debug|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Debug|x86.Build.0 = Debug|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Release|Any CPU.Build.0 = Release|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Release|x64.ActiveCfg = Release|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Release|x64.Build.0 = Release|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Release|x86.ActiveCfg = Release|Any CPU + {0014110E-EC85-4D97-BFC4-D1485511B4C1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -340,6 +354,7 @@ Global {66406BE8-0281-4C95-B90B-20CAE4516A16} = {E412EC77-2022-4A1D-AAC1-FDF1A4A45827} {2B089420-E791-44E7-B471-F6F527B33E1C} = {E412EC77-2022-4A1D-AAC1-FDF1A4A45827} {17BCA132-1FBB-46C1-B6A1-60F64969383D} = {E412EC77-2022-4A1D-AAC1-FDF1A4A45827} + {0014110E-EC85-4D97-BFC4-D1485511B4C1} = {EF615D18-42E2-48A4-8EBA-E652DC574C56} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {28B4CC2B-39E8-49C0-9687-78121BD83A53} diff --git a/src/NetEvolve.HealthChecks.Azure.Cosmos/Class1.cs b/src/NetEvolve.HealthChecks.Azure.Cosmos/Class1.cs new file mode 100644 index 0000000..5ac383d --- /dev/null +++ b/src/NetEvolve.HealthChecks.Azure.Cosmos/Class1.cs @@ -0,0 +1,3 @@ +namespace NetEvolve.HealthChecks.Azure.Cosmos; + +public class Class1 { } diff --git a/src/NetEvolve.HealthChecks.Azure.Cosmos/NetEvolve.HealthChecks.Azure.Cosmos.csproj b/src/NetEvolve.HealthChecks.Azure.Cosmos/NetEvolve.HealthChecks.Azure.Cosmos.csproj new file mode 100644 index 0000000..f156229 --- /dev/null +++ b/src/NetEvolve.HealthChecks.Azure.Cosmos/NetEvolve.HealthChecks.Azure.Cosmos.csproj @@ -0,0 +1,22 @@ + + + + $(_ProjectTargetFrameworks) + + Contains HealthChecks for Azure CosmosDB. + $(PackageTags);azure;cosmos;cosmosdb; + + true + + + + + + + + + + + + + diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/Azure/Cosmos/CosmosDbContainer.cs b/tests/NetEvolve.HealthChecks.Tests.Integration/Azure/Cosmos/CosmosDbContainer.cs new file mode 100644 index 0000000..6d36f00 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/Azure/Cosmos/CosmosDbContainer.cs @@ -0,0 +1,18 @@ +namespace NetEvolve.HealthChecks.Tests.Integration.Azure.Cosmos; + +using System; +using System.Threading.Tasks; +using Testcontainers.CosmosDb; +using TestContainer = Testcontainers.CosmosDb.CosmosDbContainer; + +public sealed class CosmosDbContainer : IAsyncLifetime, IAsyncDisposable +{ + private readonly TestContainer _container = new CosmosDbBuilder().Build(); + + public async Task DisposeAsync() => await _container.DisposeAsync().ConfigureAwait(false); + + public async Task InitializeAsync() => await _container.StartAsync().ConfigureAwait(false); + + async ValueTask IAsyncDisposable.DisposeAsync() => + await _container.DisposeAsync().ConfigureAwait(false); +} diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/NetEvolve.HealthChecks.Tests.Integration.csproj b/tests/NetEvolve.HealthChecks.Tests.Integration/NetEvolve.HealthChecks.Tests.Integration.csproj index d22a7ed..8da023d 100644 --- a/tests/NetEvolve.HealthChecks.Tests.Integration/NetEvolve.HealthChecks.Tests.Integration.csproj +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/NetEvolve.HealthChecks.Tests.Integration.csproj @@ -18,6 +18,7 @@ +