Accept combined production routing sources
Test and publish container images / test (push) Successful in 2m35s
Test and publish container images / publish (push) Successful in 1m53s

This commit is contained in:
BuTzZ
2026-07-29 14:26:33 +02:00
parent f78dea36b9
commit 0211453281
3 changed files with 106 additions and 6 deletions
+52 -5
View File
@@ -433,7 +433,56 @@ wm_wait_for_health() {
wm_smoke_test_route() {
wm_compose exec --no-TTY watermaps node --input-type=module --eval '
const expectedSource = "local-geofabrik-germany+netherlands";
// ROUTE_SOURCE_VALIDATOR_START
const localEdgeSource = "local-geofabrik-germany+netherlands";
const postgisEdgeSource = "postgis-osm";
const bboxSource = String.raw`-?\d{1,3}\.\d{3}(?:--?\d{1,3}\.\d{3}){3}`;
const localGraphPattern = new RegExp(
`^fairway-graph:local-geofabrik-${bboxSource}$`
);
const combinedGraphPattern = new RegExp(
`^fairway-graph:combined-postgis-(${bboxSource})\\+local-geofabrik-\\1$`
);
const hasExpectedRouteSources = (dataSources) => {
if (
!Array.isArray(dataSources)
|| dataSources.length < 2
|| dataSources.some((source) => typeof source !== "string")
|| new Set(dataSources).size !== dataSources.length
) {
return false;
}
const graphSources = dataSources.filter((source) =>
source.startsWith("fairway-graph:")
);
const edgeSources = dataSources.filter((source) =>
!source.startsWith("fairway-graph:")
);
if (
graphSources.length !== 1
|| edgeSources.length === 0
|| edgeSources.some(
(source) => source !== localEdgeSource && source !== postgisEdgeSource
)
) {
return false;
}
const graphSource = graphSources[0];
return (
localGraphPattern.test(graphSource)
&& edgeSources.length === 1
&& edgeSources[0] === localEdgeSource
) || (
combinedGraphPattern.test(graphSource)
&& (
edgeSources.includes(localEdgeSource)
|| edgeSources.includes(postgisEdgeSource)
)
);
};
// ROUTE_SOURCE_VALIDATOR_END
const routeChecks = [
{
name: "EmdenDitzum",
@@ -552,8 +601,7 @@ wm_smoke_test_route() {
alternative.routingMode === "fairway"
&& Array.isArray(alternative.geometry?.coordinates)
&& alternative.geometry.coordinates.length >= 2
&& Array.isArray(alternative.dataSources)
&& alternative.dataSources.includes(expectedSource)
&& hasExpectedRouteSources(alternative.dataSources)
);
const routeSignatures = [
route.geometry?.coordinates,
@@ -563,8 +611,7 @@ wm_smoke_test_route() {
route.routingMode !== "fairway" ||
!Array.isArray(routeCoordinates) ||
routeCoordinates.length < (routeCheck.minimumCoordinates ?? 2) ||
!Array.isArray(route.dataSources) ||
!route.dataSources.includes(expectedSource) ||
!hasExpectedRouteSources(route.dataSources) ||
alternatives.length < routeCheck.minimumAlternatives ||
route.distanceNm < (routeCheck.minimumDistanceNm ?? 0) ||
route.distanceNm > (routeCheck.maximumDistanceNm ?? Number.POSITIVE_INFINITY) ||