tests: configure static fixture ports and update org test config

This commit is contained in:
Paul Schneider 2026-07-12 05:48:47 +01:00
commit 4aacaf5e51
5 changed files with 33 additions and 9 deletions

View file

@ -23,7 +23,6 @@ namespace Yavsc.Org.Tests
throw new InvalidOperationException("No HTTPS server address found");
HttpClient client = NewHttpClient();
var disco = await client.GetDiscoveryDocumentAsync(serverUrl);
if (disco.IsError) throw new Exception(disco.Error);

View file

@ -39,6 +39,8 @@ namespace Yavsc.Org.Tests;
[CollectionDefinition("Yavsc Server")]
public sealed class WebServerFixture : WebHostFixture
{
protected override int HttpsPort => 5101;
private static IConfiguration? _sharedConfiguration;
private static SiteSettings? _sharedSiteSettings;
private static ILogger? _sharedLogger;
@ -81,6 +83,11 @@ public sealed class WebServerFixture : WebHostFixture
["Smtp:Port"] = "465",
["Smtp:UserName"] = "test-user",
["Smtp:Password"] = "test-pass",
// Kestrel test config: override the default port from
// WebApplication.CreateBuilder() so that the test host
// binds to the same port as the production host would.
["Kestrel:Endpoints:Http:Url"] = "http://localhost:5100",
["Kestrel:Endpoints:Https:Url"] = builder.Configuration["Site:Authority"] ?? "https://localhost:5101"
});
Configuration = builder.Configuration;

View file

@ -1,6 +1,6 @@
{
"Site": {
"Authority": "https://localhost:5001",
"Authority": "https://localhost:5101",
"Title": "Yavsc dev",
"Slogan": "Yavsc : WIP.",
"Banner": "/images/yavsc.png",
@ -62,6 +62,16 @@
"UserName": "fakeuser",
"Password": "f/\\kePassw0rd"
}
},
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:5100"
},
"Https": {
"Url": "https://localhost:5101"
}
}
}
}