Segment-bound doctor and scheduler frontdoor chunks

This commit is contained in:
master
2026-03-10 12:47:51 +02:00
parent 1b6051662f
commit d881fff387
9 changed files with 138 additions and 15 deletions

View File

@@ -113,6 +113,45 @@ public sealed class StellaOpsRouteResolverTests
Assert.Equal("/overview", policyChildResult.RegexMatch!.Groups[1].Value);
}
[Theory]
[InlineData(@"^/doctor(?=/|$)(.*)", "http://doctor.stella-ops.local$1", "/doctor.routes-JHTKGEQ6.js", StellaOpsRouteType.StaticFiles, null)]
[InlineData(@"^/doctor(?=/|$)(.*)", "http://doctor.stella-ops.local$1", "/doctor/api/v1/doctor/checks", StellaOpsRouteType.Microservice, "/api/v1/doctor/checks")]
[InlineData(@"^/scheduler(?=/|$)(.*)", "http://scheduler.stella-ops.local$1", "/scheduler-ops.routes-5SHXET2O.js", StellaOpsRouteType.StaticFiles, null)]
[InlineData(@"^/scheduler(?=/|$)(.*)", "http://scheduler.stella-ops.local$1", "/scheduler/api/v1/scheduler/runs", StellaOpsRouteType.Microservice, "/api/v1/scheduler/runs")]
public void Resolve_SegmentBoundFrontdoorServiceRoots_DoNotCaptureStaticChunks(
string routePath,
string translatesTo,
string requestPath,
StellaOpsRouteType expectedType,
string? expectedCapture)
{
var resolver = new StellaOpsRouteResolver(
[
MakeRoute(
routePath,
isRegex: true,
translatesTo: translatesTo),
MakeRoute(
"/",
type: StellaOpsRouteType.StaticFiles,
translatesTo: "/app/wwwroot")
]);
var result = resolver.Resolve(new PathString(requestPath));
Assert.NotNull(result.Route);
Assert.Equal(expectedType, result.Route!.Type);
if (expectedCapture is null)
{
Assert.Null(result.RegexMatch);
return;
}
Assert.NotNull(result.RegexMatch);
Assert.Equal(expectedCapture, result.RegexMatch!.Groups[1].Value);
}
[Fact]
public void Resolve_NoMatch_ReturnsNull()
{