mirror of
https://github.com/MAKS-IT-COM/maksit-hamode.git
synced 2026-06-30 22:36:42 +02:00
(refactor): merge internal HAMode modules into one assembly and expand DI test coverage
This commit is contained in:
parent
f48e338012
commit
943460bf95
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.0.3] - 2026-06-20
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Consolidated source into a single `MaksIT.HAMode` project and assembly; removed internal multi-project packaging shell and manual DLL bundling.
|
||||||
|
- Namespaces are unchanged (`MaksIT.HAMode.Abstractions`, `MaksIT.HAMode.PostgreSql`, etc.) so consumers can upgrade without code changes.
|
||||||
|
|
||||||
## [1.0.2] - 2026-06-20
|
## [1.0.2] - 2026-06-20
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@ -6,7 +6,7 @@ Reusable high-availability runtime coordination library for MaksIT services.
|
|||||||
|
|
||||||
## Packages
|
## Packages
|
||||||
|
|
||||||
- `MaksIT.HAMode` (single NuGet package)
|
- `MaksIT.HAMode` (single NuGet package, single assembly)
|
||||||
- `MaksIT.HAMode.Extensions.ServiceCollectionExtensions`
|
- `MaksIT.HAMode.Extensions.ServiceCollectionExtensions`
|
||||||
- `MaksIT.HAMode.Abstractions` namespace:
|
- `MaksIT.HAMode.Abstractions` namespace:
|
||||||
- `IRuntimeInstanceId`
|
- `IRuntimeInstanceId`
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="20" role="img" aria-label="Branch Coverage: 37.3%">
|
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="20" role="img" aria-label="Branch Coverage: 43.6%">
|
||||||
<title>Branch Coverage: 37.3%</title>
|
<title>Branch Coverage: 43.6%</title>
|
||||||
<linearGradient id="s" x2="0" y2="100%">
|
<linearGradient id="s" x2="0" y2="100%">
|
||||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||||
<stop offset="1" stop-opacity=".1"/>
|
<stop offset="1" stop-opacity=".1"/>
|
||||||
@ -9,13 +9,13 @@
|
|||||||
</clipPath>
|
</clipPath>
|
||||||
<g clip-path="url(#r)">
|
<g clip-path="url(#r)">
|
||||||
<rect width="107.5" height="20" fill="#555"/>
|
<rect width="107.5" height="20" fill="#555"/>
|
||||||
<rect x="107.5" width="42.5" height="20" fill="#dfb317"/>
|
<rect x="107.5" width="42.5" height="20" fill="#a4a61d"/>
|
||||||
<rect width="150" height="20" fill="url(#s)"/>
|
<rect width="150" height="20" fill="url(#s)"/>
|
||||||
</g>
|
</g>
|
||||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
||||||
<text aria-hidden="true" x="53.75" y="15" fill="#010101" fill-opacity=".3">Branch Coverage</text>
|
<text aria-hidden="true" x="53.75" y="15" fill="#010101" fill-opacity=".3">Branch Coverage</text>
|
||||||
<text x="53.75" y="14" fill="#fff">Branch Coverage</text>
|
<text x="53.75" y="14" fill="#fff">Branch Coverage</text>
|
||||||
<text aria-hidden="true" x="128.75" y="15" fill="#010101" fill-opacity=".3">37.3%</text>
|
<text aria-hidden="true" x="128.75" y="15" fill="#010101" fill-opacity=".3">43.6%</text>
|
||||||
<text x="128.75" y="14" fill="#fff">37.3%</text>
|
<text x="128.75" y="14" fill="#fff">43.6%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -1,5 +1,5 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="137" height="20" role="img" aria-label="Line Coverage: 41.1%">
|
<svg xmlns="http://www.w3.org/2000/svg" width="137" height="20" role="img" aria-label="Line Coverage: 55.7%">
|
||||||
<title>Line Coverage: 41.1%</title>
|
<title>Line Coverage: 55.7%</title>
|
||||||
<linearGradient id="s" x2="0" y2="100%">
|
<linearGradient id="s" x2="0" y2="100%">
|
||||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||||
<stop offset="1" stop-opacity=".1"/>
|
<stop offset="1" stop-opacity=".1"/>
|
||||||
@ -15,7 +15,7 @@
|
|||||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
||||||
<text aria-hidden="true" x="47.25" y="15" fill="#010101" fill-opacity=".3">Line Coverage</text>
|
<text aria-hidden="true" x="47.25" y="15" fill="#010101" fill-opacity=".3">Line Coverage</text>
|
||||||
<text x="47.25" y="14" fill="#fff">Line Coverage</text>
|
<text x="47.25" y="14" fill="#fff">Line Coverage</text>
|
||||||
<text aria-hidden="true" x="115.75" y="15" fill="#010101" fill-opacity=".3">41.1%</text>
|
<text aria-hidden="true" x="115.75" y="15" fill="#010101" fill-opacity=".3">55.7%</text>
|
||||||
<text x="115.75" y="14" fill="#fff">41.1%</text>
|
<text x="115.75" y="14" fill="#fff">55.7%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -1,5 +1,5 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="20" role="img" aria-label="Method Coverage: 60.9%">
|
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="20" role="img" aria-label="Method Coverage: 76.1%">
|
||||||
<title>Method Coverage: 60.9%</title>
|
<title>Method Coverage: 76.1%</title>
|
||||||
<linearGradient id="s" x2="0" y2="100%">
|
<linearGradient id="s" x2="0" y2="100%">
|
||||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||||
<stop offset="1" stop-opacity=".1"/>
|
<stop offset="1" stop-opacity=".1"/>
|
||||||
@ -15,7 +15,7 @@
|
|||||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
||||||
<text aria-hidden="true" x="53.75" y="15" fill="#010101" fill-opacity=".3">Method Coverage</text>
|
<text aria-hidden="true" x="53.75" y="15" fill="#010101" fill-opacity=".3">Method Coverage</text>
|
||||||
<text x="53.75" y="14" fill="#fff">Method Coverage</text>
|
<text x="53.75" y="14" fill="#fff">Method Coverage</text>
|
||||||
<text aria-hidden="true" x="128.75" y="15" fill="#010101" fill-opacity=".3">60.9%</text>
|
<text aria-hidden="true" x="128.75" y="15" fill="#010101" fill-opacity=".3">76.1%</text>
|
||||||
<text x="128.75" y="14" fill="#fff">60.9%</text>
|
<text x="128.75" y="14" fill="#fff">76.1%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -1,46 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
|
||||||
|
|
||||||
<PackageId>MaksIT.HAMode.Abstractions</PackageId>
|
|
||||||
<Version>0.1.0</Version>
|
|
||||||
<Authors>Maksym Sadovnychyy</Authors>
|
|
||||||
<Company>MAKS-IT</Company>
|
|
||||||
<Product>MaksIT.HAMode</Product>
|
|
||||||
<Copyright>Copyright © Maksym Sadovnychyy (MAKS-IT)</Copyright>
|
|
||||||
<Description>Shared high-availability abstractions for MaksIT services, including runtime instance identity and lease coordination contracts.</Description>
|
|
||||||
<PackageTags>dotnet;ha;high-availability;runtime;lease;coordination;postgresql;kubernetes</PackageTags>
|
|
||||||
<PackageProjectUrl>https://github.com/MAKS-IT-COM/maksit-hamode</PackageProjectUrl>
|
|
||||||
<RepositoryUrl>https://github.com/MAKS-IT-COM/maksit-hamode</RepositoryUrl>
|
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
|
||||||
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
|
|
||||||
<PackageReleaseNotes>See CHANGELOG.md in the package and repository releases.</PackageReleaseNotes>
|
|
||||||
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
|
||||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
|
||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
|
||||||
<Deterministic>true</Deterministic>
|
|
||||||
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="MaksIT.Results" Version="2.0.2" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="11.0.0-preview.5.26302.115" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="\" Link="LICENSE.md" />
|
|
||||||
<None Include="..\..\README.md" Pack="true" PackagePath="\" Link="README.md" />
|
|
||||||
<None Include="..\..\CHANGELOG.md" Pack="true" PackagePath="\" Link="CHANGELOG.md" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
|
||||||
|
|
||||||
<PackageId>MaksIT.HAMode.Etcd</PackageId>
|
|
||||||
<Version>0.1.0</Version>
|
|
||||||
<Authors>Maksym Sadovnychyy</Authors>
|
|
||||||
<Company>MAKS-IT</Company>
|
|
||||||
<Product>MaksIT.HAMode</Product>
|
|
||||||
<Copyright>Copyright © Maksym Sadovnychyy (MAKS-IT)</Copyright>
|
|
||||||
<Description>etcd runtime lease implementation for MaksIT HA mode, using transactions and lease-backed keys.</Description>
|
|
||||||
<PackageTags>dotnet;ha;high-availability;runtime;lease;coordination;etcd;grpc;kubernetes</PackageTags>
|
|
||||||
<PackageProjectUrl>https://github.com/MAKS-IT-COM/maksit-hamode</PackageProjectUrl>
|
|
||||||
<RepositoryUrl>https://github.com/MAKS-IT-COM/maksit-hamode</RepositoryUrl>
|
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
|
||||||
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
|
|
||||||
<PackageReleaseNotes>See CHANGELOG.md in the package and repository releases.</PackageReleaseNotes>
|
|
||||||
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
|
||||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
|
||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
|
||||||
<Deterministic>true</Deterministic>
|
|
||||||
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="dotnet-etcd" Version="8.1.0" />
|
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.35.1" />
|
|
||||||
<PackageReference Include="MaksIT.Results" Version="2.0.2" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="11.0.0-preview.5.26302.115" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Abstractions\MaksIT.HAMode.Abstractions.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="\" Link="LICENSE.md" />
|
|
||||||
<None Include="..\..\README.md" Pack="true" PackagePath="\" Link="README.md" />
|
|
||||||
<None Include="..\..\CHANGELOG.md" Pack="true" PackagePath="\" Link="CHANGELOG.md" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
|
||||||
|
|
||||||
<PackageId>MaksIT.HAMode.PostgreSql</PackageId>
|
|
||||||
<Version>0.1.0</Version>
|
|
||||||
<Authors>Maksym Sadovnychyy</Authors>
|
|
||||||
<Company>MAKS-IT</Company>
|
|
||||||
<Product>MaksIT.HAMode</Product>
|
|
||||||
<Copyright>Copyright © Maksym Sadovnychyy (MAKS-IT)</Copyright>
|
|
||||||
<Description>PostgreSQL runtime lease implementation for MaksIT HA mode, based on app_runtime_leases coordination table.</Description>
|
|
||||||
<PackageTags>dotnet;ha;high-availability;runtime;lease;coordination;postgresql;npgsql;kubernetes</PackageTags>
|
|
||||||
<PackageProjectUrl>https://github.com/MAKS-IT-COM/maksit-hamode</PackageProjectUrl>
|
|
||||||
<RepositoryUrl>https://github.com/MAKS-IT-COM/maksit-hamode</RepositoryUrl>
|
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
|
||||||
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
|
|
||||||
<PackageReleaseNotes>See CHANGELOG.md in the package and repository releases.</PackageReleaseNotes>
|
|
||||||
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
|
||||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
|
||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
|
||||||
<Deterministic>true</Deterministic>
|
|
||||||
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="MaksIT.Results" Version="2.0.2" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="11.0.0-preview.5.26302.115" />
|
|
||||||
<PackageReference Include="Npgsql" Version="10.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Abstractions\MaksIT.HAMode.Abstractions.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="\" Link="LICENSE.md" />
|
|
||||||
<None Include="..\..\README.md" Pack="true" PackagePath="\" Link="README.md" />
|
|
||||||
<None Include="..\..\CHANGELOG.md" Pack="true" PackagePath="\" Link="CHANGELOG.md" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
|
||||||
|
|
||||||
<PackageId>MaksIT.HAMode.Redis</PackageId>
|
|
||||||
<Version>0.1.0</Version>
|
|
||||||
<Authors>Maksym Sadovnychyy</Authors>
|
|
||||||
<Company>MAKS-IT</Company>
|
|
||||||
<Product>MaksIT.HAMode</Product>
|
|
||||||
<Copyright>Copyright © Maksym Sadovnychyy (MAKS-IT)</Copyright>
|
|
||||||
<Description>Redis runtime lease implementation for MaksIT HA mode, using atomic Lua scripts and TTL-bound keys.</Description>
|
|
||||||
<PackageTags>dotnet;ha;high-availability;runtime;lease;coordination;redis;stackexchange-redis;kubernetes</PackageTags>
|
|
||||||
<PackageProjectUrl>https://github.com/MAKS-IT-COM/maksit-hamode</PackageProjectUrl>
|
|
||||||
<RepositoryUrl>https://github.com/MAKS-IT-COM/maksit-hamode</RepositoryUrl>
|
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
|
||||||
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
|
|
||||||
<PackageReleaseNotes>See CHANGELOG.md in the package and repository releases.</PackageReleaseNotes>
|
|
||||||
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
|
||||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
|
||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
|
||||||
<Deterministic>true</Deterministic>
|
|
||||||
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="MaksIT.Results" Version="2.0.2" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="11.0.0-preview.5.26302.115" />
|
|
||||||
<PackageReference Include="StackExchange.Redis" Version="3.0.47-preview" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Abstractions\MaksIT.HAMode.Abstractions.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="\" Link="LICENSE.md" />
|
|
||||||
<None Include="..\..\README.md" Pack="true" PackagePath="\" Link="README.md" />
|
|
||||||
<None Include="..\..\CHANGELOG.md" Pack="true" PackagePath="\" Link="CHANGELOG.md" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -13,8 +13,8 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.8" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="11.0.0-preview.5.26302.115" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="11.0.0-preview.5.26302.115" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
@ -24,10 +24,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Abstractions\MaksIT.HAMode.Abstractions.csproj" />
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.PostgreSql\MaksIT.HAMode.PostgreSql.csproj" />
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Redis\MaksIT.HAMode.Redis.csproj" />
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Etcd\MaksIT.HAMode.Etcd.csproj" />
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode\MaksIT.HAMode.csproj" />
|
<ProjectReference Include="..\MaksIT.HAMode\MaksIT.HAMode.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
using MaksIT.HAMode.Etcd;
|
using MaksIT.HAMode.Etcd;
|
||||||
using MaksIT.HAMode.PostgreSql;
|
using MaksIT.HAMode.PostgreSql;
|
||||||
using MaksIT.HAMode.Redis;
|
using MaksIT.HAMode.Redis;
|
||||||
|
using dotnet_etcd;
|
||||||
using Microsoft.Extensions.Logging.Abstractions;
|
using Microsoft.Extensions.Logging.Abstractions;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
|
using StackExchange.Redis;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace MaksIT.HAMode.Tests;
|
namespace MaksIT.HAMode.Tests;
|
||||||
@ -153,6 +155,33 @@ public sealed class RuntimeLeaseServiceValidationTests {
|
|||||||
Assert.Equal(HttpStatusCode.BadRequest, result.StatusCode);
|
Assert.Equal(HttpStatusCode.BadRequest, result.StatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Redis_TryAcquire_WithSharedMultiplexer_AllowsEmptyConfiguration() {
|
||||||
|
var multiplexer = ConnectionMultiplexer.Connect("127.0.0.1:63999,abortConnect=false,connectTimeout=1");
|
||||||
|
var service = new RuntimeLeaseServiceRedis(
|
||||||
|
new TestRedisProvider { Configuration = "" },
|
||||||
|
NullLogger<RuntimeLeaseServiceRedis>.Instance,
|
||||||
|
multiplexer);
|
||||||
|
|
||||||
|
var result = await service.TryAcquireAsync("lease", "holder", PositiveTtl, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
|
Assert.NotEqual(HttpStatusCode.BadRequest, result.StatusCode);
|
||||||
|
await service.DisposeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Etcd_TryAcquire_WithSharedClient_AllowsEmptyEndpoints() {
|
||||||
|
var client = new EtcdClient("http://127.0.0.1:2379");
|
||||||
|
var service = new RuntimeLeaseServiceEtcd(
|
||||||
|
new TestEtcdProvider { Endpoints = "" },
|
||||||
|
NullLogger<RuntimeLeaseServiceEtcd>.Instance,
|
||||||
|
client);
|
||||||
|
|
||||||
|
var result = await service.TryAcquireAsync("lease", "holder", PositiveTtl, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
|
Assert.NotEqual(HttpStatusCode.BadRequest, result.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Etcd_TryAcquire_MissingKeyPrefix_ReturnsBadRequest() {
|
public async Task Etcd_TryAcquire_MissingKeyPrefix_ReturnsBadRequest() {
|
||||||
var service = new RuntimeLeaseServiceEtcd(
|
var service = new RuntimeLeaseServiceEtcd(
|
||||||
|
|||||||
@ -20,6 +20,94 @@ public sealed class ServiceCollectionExtensionsTests {
|
|||||||
var instanceId = provider.GetRequiredService<IRuntimeInstanceId>();
|
var instanceId = provider.GetRequiredService<IRuntimeInstanceId>();
|
||||||
|
|
||||||
Assert.IsType<RuntimeInstanceIdProvider>(instanceId);
|
Assert.IsType<RuntimeInstanceIdProvider>(instanceId);
|
||||||
|
Assert.Same(typeof(RuntimeInstanceIdProvider).Assembly, instanceId.GetType().Assembly);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddHAModePostgreSqlLease_WithGenericProvider_RegistersLeaseServiceOnly() {
|
||||||
|
var services = new ServiceCollection()
|
||||||
|
.AddLogging()
|
||||||
|
.AddHAModePostgreSqlLease<TestPgProvider>();
|
||||||
|
|
||||||
|
var provider = services.BuildServiceProvider();
|
||||||
|
|
||||||
|
Assert.IsType<TestPgProvider>(provider.GetRequiredService<IRuntimeLeaseConnectionStringProvider>());
|
||||||
|
Assert.IsType<RuntimeLeaseServiceNpgsql>(provider.GetRequiredService<IRuntimeLeaseService>());
|
||||||
|
Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<IRuntimeInstanceId>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddHAModeRedisLease_WithGenericProvider_RegistersLeaseServiceOnly() {
|
||||||
|
var services = new ServiceCollection()
|
||||||
|
.AddLogging()
|
||||||
|
.AddHAModeRedisLease<TestRedisProvider>();
|
||||||
|
|
||||||
|
var provider = services.BuildServiceProvider();
|
||||||
|
|
||||||
|
Assert.IsType<TestRedisProvider>(provider.GetRequiredService<IRuntimeLeaseRedisConnectionProvider>());
|
||||||
|
Assert.IsType<RuntimeLeaseServiceRedis>(provider.GetRequiredService<IRuntimeLeaseService>());
|
||||||
|
Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<IRuntimeInstanceId>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddHAModeEtcdLease_WithGenericProvider_RegistersLeaseServiceOnly() {
|
||||||
|
var services = new ServiceCollection()
|
||||||
|
.AddLogging()
|
||||||
|
.AddHAModeEtcdLease<TestEtcdProvider>();
|
||||||
|
|
||||||
|
var provider = services.BuildServiceProvider();
|
||||||
|
|
||||||
|
Assert.IsType<TestEtcdProvider>(provider.GetRequiredService<IRuntimeLeaseEtcdConnectionProvider>());
|
||||||
|
Assert.IsType<RuntimeLeaseServiceEtcd>(provider.GetRequiredService<IRuntimeLeaseService>());
|
||||||
|
Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<IRuntimeInstanceId>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddHAModePostgreSqlLease_WithSharedDataSource_RegistersLeaseServiceOnly() {
|
||||||
|
var configuration = new TestPgProvider();
|
||||||
|
var dataSource = NpgsqlDataSource.Create("Host=127.0.0.1;Port=5432;Database=hamode;Username=hamode;Password=hamode");
|
||||||
|
var services = new ServiceCollection()
|
||||||
|
.AddLogging()
|
||||||
|
.AddHAModePostgreSqlLease(configuration, dataSource);
|
||||||
|
|
||||||
|
var provider = services.BuildServiceProvider();
|
||||||
|
|
||||||
|
Assert.Same(configuration, provider.GetRequiredService<IRuntimeLeaseConnectionStringProvider>());
|
||||||
|
Assert.Same(dataSource, provider.GetRequiredService<NpgsqlDataSource>());
|
||||||
|
Assert.IsType<RuntimeLeaseServiceNpgsql>(provider.GetRequiredService<IRuntimeLeaseService>());
|
||||||
|
Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<IRuntimeInstanceId>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddHAModeRedisLease_WithSharedMultiplexer_RegistersLeaseServiceOnly() {
|
||||||
|
var configuration = new TestRedisProvider();
|
||||||
|
var multiplexer = ConnectionMultiplexer.Connect("127.0.0.1:63999,abortConnect=false,connectTimeout=1");
|
||||||
|
var services = new ServiceCollection()
|
||||||
|
.AddLogging()
|
||||||
|
.AddHAModeRedisLease(configuration, multiplexer);
|
||||||
|
|
||||||
|
var provider = services.BuildServiceProvider();
|
||||||
|
|
||||||
|
Assert.Same(configuration, provider.GetRequiredService<IRuntimeLeaseRedisConnectionProvider>());
|
||||||
|
Assert.Same(multiplexer, provider.GetRequiredService<IConnectionMultiplexer>());
|
||||||
|
Assert.IsType<RuntimeLeaseServiceRedis>(provider.GetRequiredService<IRuntimeLeaseService>());
|
||||||
|
Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<IRuntimeInstanceId>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddHAModeEtcdLease_WithSharedClient_RegistersLeaseServiceOnly() {
|
||||||
|
var configuration = new TestEtcdProvider();
|
||||||
|
var client = new EtcdClient("http://127.0.0.1:2379");
|
||||||
|
var services = new ServiceCollection()
|
||||||
|
.AddLogging()
|
||||||
|
.AddHAModeEtcdLease(configuration, client);
|
||||||
|
|
||||||
|
var provider = services.BuildServiceProvider();
|
||||||
|
|
||||||
|
Assert.Same(configuration, provider.GetRequiredService<IRuntimeLeaseEtcdConnectionProvider>());
|
||||||
|
Assert.Same(client, provider.GetRequiredService<EtcdClient>());
|
||||||
|
Assert.IsType<RuntimeLeaseServiceEtcd>(provider.GetRequiredService<IRuntimeLeaseService>());
|
||||||
|
Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<IRuntimeInstanceId>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
<Solution>
|
<Solution>
|
||||||
<Project Path="MaksIT.HAMode.Abstractions/MaksIT.HAMode.Abstractions.csproj" />
|
|
||||||
<Project Path="MaksIT.HAMode.Etcd/MaksIT.HAMode.Etcd.csproj" />
|
|
||||||
<Project Path="MaksIT.HAMode.PostgreSql/MaksIT.HAMode.PostgreSql.csproj" />
|
|
||||||
<Project Path="MaksIT.HAMode.Redis/MaksIT.HAMode.Redis.csproj" />
|
|
||||||
<Project Path="MaksIT.HAMode.Tests/MaksIT.HAMode.Tests.csproj" />
|
|
||||||
<Project Path="MaksIT.HAMode/MaksIT.HAMode.csproj" />
|
<Project Path="MaksIT.HAMode/MaksIT.HAMode.csproj" />
|
||||||
|
<Project Path="MaksIT.HAMode.Tests/MaksIT.HAMode.Tests.csproj" />
|
||||||
</Solution>
|
</Solution>
|
||||||
|
|||||||
@ -6,10 +6,9 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<IncludeBuildOutput>true</IncludeBuildOutput>
|
|
||||||
|
|
||||||
<PackageId>MaksIT.HAMode</PackageId>
|
<PackageId>MaksIT.HAMode</PackageId>
|
||||||
<Version>1.0.2</Version>
|
<Version>1.0.3</Version>
|
||||||
<Authors>Maksym Sadovnychyy</Authors>
|
<Authors>Maksym Sadovnychyy</Authors>
|
||||||
<Company>MAKS-IT</Company>
|
<Company>MAKS-IT</Company>
|
||||||
<Product>MaksIT.HAMode</Product>
|
<Product>MaksIT.HAMode</Product>
|
||||||
@ -31,17 +30,11 @@
|
|||||||
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
|
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Abstractions\MaksIT.HAMode.Abstractions.csproj" PrivateAssets="all" TreatAsPackageReference="false" />
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.PostgreSql\MaksIT.HAMode.PostgreSql.csproj" PrivateAssets="all" TreatAsPackageReference="false" />
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Redis\MaksIT.HAMode.Redis.csproj" PrivateAssets="all" TreatAsPackageReference="false" />
|
|
||||||
<ProjectReference Include="..\MaksIT.HAMode.Etcd\MaksIT.HAMode.Etcd.csproj" PrivateAssets="all" TreatAsPackageReference="false" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="dotnet-etcd" Version="8.1.0" />
|
<PackageReference Include="dotnet-etcd" Version="8.1.0" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.35.1" />
|
<PackageReference Include="Google.Protobuf" Version="3.35.1" />
|
||||||
<PackageReference Include="MaksIT.Results" Version="2.0.2" />
|
<PackageReference Include="MaksIT.Results" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="11.0.0-preview.5.26302.115" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="11.0.0-preview.5.26302.115" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="11.0.0-preview.5.26302.115" />
|
||||||
<PackageReference Include="Npgsql" Version="10.0.3" />
|
<PackageReference Include="Npgsql" Version="10.0.3" />
|
||||||
<PackageReference Include="StackExchange.Redis" Version="3.0.47-preview" />
|
<PackageReference Include="StackExchange.Redis" Version="3.0.47-preview" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user