-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* at the begining of each sql functional test it should re-init the container to make sure we start clean added more sql unit tests * add ignite migrations tests * add nswag tests * add 1 unit test for health check * add ignite serilog tests * add Swashbuckle functional and unit tests * add seq fixture container and seq functional tests * more unit tests for sql * export a random port for seq to avoid conflicts * create SUT for OpenTelemetry (seq) add an option to send the seq connection string from the fixture to the SUT (dynamic ports and so on)
- Loading branch information
1 parent
a0f40fa
commit 3b89401
Showing
30 changed files
with
956 additions
and
1 deletion.
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
42 changes: 42 additions & 0 deletions
42
...nite.AspNetCore.HealthChecks.UI.Tests/Interceptors/IPv6LoopbackAddressInterceptorTests.cs
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,42 @@ | ||
using ES.FX.Ignite.AspNetCore.HealthChecks.UI.Interceptors; | ||
using HealthChecks.UI.Data; | ||
using Microsoft.AspNetCore.Hosting.Server; | ||
using Microsoft.AspNetCore.Hosting.Server.Features; | ||
using Moq; | ||
|
||
namespace ES.FX.Ignite.AspNetCore.HealthChecks.UI.Tests.Interceptors | ||
{ | ||
public class IPv6LoopbackAddressInterceptorTests | ||
{ | ||
[Fact] | ||
public async Task OnCollectExecuting_ShouldFixRelativeHealthCheckAddresses_WhenUsingIPv6LoopbackAddress() | ||
{ | ||
var server = new Mock<IServer>(); | ||
var addressFeature = new Mock<IServerAddressesFeature>(); | ||
addressFeature.Setup(f => f.Addresses).Returns(["http://[::]"]); | ||
server.Setup(s => s.Features.Get<IServerAddressesFeature>()).Returns(addressFeature.Object); | ||
|
||
var interceptor = new IPv6LoopbackAddressInterceptor(server.Object); | ||
var configuration = new HealthCheckConfiguration { Uri = "/health" }; | ||
|
||
await interceptor.OnCollectExecuting(configuration); | ||
|
||
Assert.Equal("http://[::1]/health", configuration.Uri); | ||
} | ||
|
||
[Fact] | ||
public async Task OnCollectExecuting_ShouldIgnoreNonIP6OrCorrectURI() | ||
{ | ||
var uri = "http://192.168.1.1/health"; | ||
var server = new Mock<IServer>(); | ||
var addressFeature = new Mock<IServerAddressesFeature>(); | ||
|
||
var interceptor = new IPv6LoopbackAddressInterceptor(server.Object); | ||
var configuration = new HealthCheckConfiguration { Uri = uri }; | ||
|
||
await interceptor.OnCollectExecuting(configuration); | ||
|
||
Assert.Equal(uri, configuration.Uri); | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
tests/ES.FX.Ignite.Migrations.Tests/ES.FX.Ignite.Migrations.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,35 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> | ||
<PackageReference Include="Moq" Version="4.20.70" /> | ||
<PackageReference Include="xunit" Version="2.9.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\ES.FX.Ignite.Migrations\ES.FX.Ignite.Migrations.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="Xunit" /> | ||
</ItemGroup> | ||
|
||
</Project> |
35 changes: 35 additions & 0 deletions
35
tests/ES.FX.Ignite.Migrations.Tests/Hosting/MigrationsServiceHostingExtensionsTests.cs
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,35 @@ | ||
using Microsoft.Extensions.Hosting; | ||
using ES.FX.Ignite.Migrations.Hosting; | ||
using ES.FX.Ignite.Spark.Exceptions; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using ES.FX.Ignite.Migrations.Service; | ||
using ES.FX.Ignite.Migrations.Configuration; | ||
|
||
namespace ES.FX.Ignite.Migrations.Tests.Hosting | ||
{ | ||
public class MigrationsServiceHostingExtensionsTests | ||
{ | ||
[Fact] | ||
public void IgniteDoesNotAllowReconfiguration() | ||
{ | ||
var builder = Host.CreateEmptyApplicationBuilder(null); | ||
|
||
builder.IgniteMigrationsService(); | ||
|
||
Assert.Throws<ReconfigurationNotSupportedException>(() => builder.IgniteMigrationsService()); | ||
} | ||
|
||
[Fact] | ||
public void IgniteShouldAddTheServices() | ||
{ | ||
var builder = Host.CreateEmptyApplicationBuilder(null); | ||
|
||
builder.IgniteMigrationsService(); | ||
|
||
var serviceProvider = builder.Build().Services; | ||
var migrationService = serviceProvider.GetRequiredService<IHostedService>(); | ||
Assert.True(migrationService is MigrationsService); | ||
Assert.NotNull(serviceProvider.GetRequiredService<MigrationsServiceSparkSettings>()); | ||
} | ||
} | ||
} |
Oops, something went wrong.