Implement NodeJS based server fully replicating osrm-routed

This commit is contained in:
Siarhei Fedartsou 2022-10-23 14:18:52 +02:00
parent 53f2da5d5e
commit 251ffe4a50
8 changed files with 22 additions and 17 deletions

View File

@ -115,4 +115,4 @@ Feature: Annotations
When I route I should get When I route I should get
| from | to | route | a:speed | a:distance | a:duration | a:nodes | | from | to | route | a:speed | a:distance | a:duration | a:nodes |
| a | c | abc,abc | 10:10 | 249.987618946:299.962882039 | 25:30 | 1:2:3 | | a | c | abc,abc | 10:10 | 249.987618946:299.962882039 +- 1e-7 | 25:30 | 1:2:3 |

View File

@ -80,7 +80,7 @@ Feature: Testbot - Exclude flags
| a | c | | | a | c | |
| a | f | | | a | f | |
| f | d | fg,gd,gd | | f | d | fg,gd,gd |
@skip_on_routed_js
Scenario: Testbot - exclude with unsupported exclude combination Scenario: Testbot - exclude with unsupported exclude combination
Given the query options Given the query options
| exclude | TwoWords2 | | exclude | TwoWords2 |
@ -88,7 +88,7 @@ Feature: Testbot - Exclude flags
When I route I should get When I route I should get
| from | to | status | message | | from | to | status | message |
| a | d | 400 | Exclude flag combination is not supported. | | a | d | 400 | Exclude flag combination is not supported. |
@skip_on_routed_js
Scenario: Testbot - exclude with invalid exclude class name Scenario: Testbot - exclude with invalid exclude class name
Given the query options Given the query options
| exclude | foo | | exclude | foo |

View File

@ -563,6 +563,7 @@ Feature: Basic Map Matching
| trace | timestamps | code | | trace | timestamps | code |
| abcd | 0 1 62 63 | NoMatch | | abcd | 0 1 62 63 | NoMatch |
@skip_on_routed_js
Scenario: Testbot - Map matching invalid waypoints Scenario: Testbot - Map matching invalid waypoints
Given the node map Given the node map
""" """
@ -580,6 +581,7 @@ Feature: Basic Map Matching
| trace | code | | trace | code |
| abcd | InvalidOptions | | abcd | InvalidOptions |
@skip_on_routed_js
Scenario: Matching fail with waypoints param missing start/end Scenario: Matching fail with waypoints param missing start/end
Given the node map Given the node map
""" """
@ -788,7 +790,7 @@ Feature: Basic Map Matching
| 1234 | 1.000135,1,1.000225,1,1.000404,1,1.000449,1 | 1:2:0.4 | 1:2:0.4 | 3.4 | | 1234 | 1.000135,1,1.000225,1,1.000404,1,1.000449,1 | 1:2:0.4 | 1:2:0.4 | 3.4 |
| 4321 | 1.000449,1,1.000404,1,1.000225,1,1.000135,1 | 0.4:2:1 | 0.4:2:1 | 3.4 | | 4321 | 1.000449,1,1.000404,1,1.000225,1,1.000135,1 | 0.4:2:1 | 0.4:2:1 | 3.4 |
@match @testbot @match @testbot @skip_on_routed_js
Scenario: Regression test - add source phantom properly (two phantoms on one edge) Scenario: Regression test - add source phantom properly (two phantoms on one edge)
Given the profile "testbot" Given the profile "testbot"
Given a grid size of 10 meters Given a grid size of 10 meters
@ -809,7 +811,7 @@ Feature: Basic Map Matching
# These should have the same weights/duration in either direction # These should have the same weights/duration in either direction
When I match I should get When I match I should get
| trace | geometry | a:distance | a:duration | a:weight | duration | | trace | geometry | a:distance | a:duration | a:weight | duration |
| 2345 | 1.00018,1,1.000314,1 | 14.914666491 | 1.4 | 1.4 | 1.4 | | 2345 | 1.00018,1,1.000314,1 | 14.914666491 | 1.4 | 1.4 | 1.4 |
| 4321 | 1.00027,1,1.000135,1 | 15.025969972 | 1.5 | 1.5 | 1.5 | | 4321 | 1.00027,1,1.000135,1 | 15.025969972 | 1.5 | 1.5 | 1.5 |

View File

@ -18,7 +18,7 @@ Feature: Status messages
| from | to | route | status | message | | from | to | route | status | message |
| a | b | ab,ab | 200 | | | a | b | ab,ab | 200 | |
| b | a | ab,ab | 200 | | | b | a | ab,ab | 200 | |
@skip_on_routed_js
Scenario: No route found Scenario: No route found
Given the node map Given the node map
""" """

View File

@ -223,7 +223,7 @@ Feature: Basic trip planning
| waypoints | trips | roundtrip | durations | | waypoints | trips | roundtrip | durations |
| a,b,c,d,e,f,g,h,i,j,k,l | lkjihgfedcbal | true | 22 | | a,b,c,d,e,f,g,h,i,j,k,l | lkjihgfedcbal | true | 22 |
| a,b,c,d,e,f,g,h,i,j,k,l | cbakjihgfedl | false | 19 | | a,b,c,d,e,f,g,h,i,j,k,l | cbakjihgfedl | false | 19 |
@skip_on_routed_js
Scenario: Testbot - Trip: Unroutable roundtrip with waypoints (less than 10) Scenario: Testbot - Trip: Unroutable roundtrip with waypoints (less than 10)
Given the node map Given the node map
""" """
@ -241,7 +241,7 @@ Feature: Basic trip planning
| waypoints | status | message | | waypoints | status | message |
| a,b,c,d | NoTrips | No trip visiting all destinations possible. | | a,b,c,d | NoTrips | No trip visiting all destinations possible. |
@skip_on_routed_js
Scenario: Testbot - Trip: Unroutable roundtrip with waypoints (more than 10) Scenario: Testbot - Trip: Unroutable roundtrip with waypoints (more than 10)
Given the node map Given the node map
""" """
@ -279,6 +279,7 @@ Feature: Basic trip planning
| a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p | NoTrips | No trip visiting all destinations possible. | | a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p | NoTrips | No trip visiting all destinations possible. |
# Test TFSE # Test TFSE
@skip_on_routed_js
Scenario: Testbot - Trip: TFSE with errors Scenario: Testbot - Trip: TFSE with errors
Given the node map Given the node map
""" """
@ -372,7 +373,7 @@ Feature: Basic trip planning
| waypoints | source | destination | roundtrip | trips | | waypoints | source | destination | roundtrip | trips |
| a,b,d,e,c | first | last | true | abedca | | a,b,d,e,c | first | last | true | abedca |
@skip_on_routed_js
Scenario: Testbot - Trip: midway points in isolated roads should return no trips Scenario: Testbot - Trip: midway points in isolated roads should return no trips
Given the node map Given the node map
""" """

View File

@ -52,11 +52,11 @@ Feature: Weight tests
| abc | | abc |
When I route I should get When I route I should get
| waypoints | route | distances | weights | times | a:distance | a:duration | a:weight | a:speed | | waypoints | route | distances | weights | times | a:distance | a:duration | a:weight | a:speed |
| s,t | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034626629 | 2 | 2 | 10 | | s,t | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034626629 +- 1e-7 | 2 | 2 | 10 |
| t,s | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034626629 | 2 | 2 | 10 | | t,s | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034626629 +- 1e-7 | 2 | 2 | 10 |
| s,e | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 29.940636463:10.017313314 | 3:0.9 | 3:0.9 | 10:11.1 | | s,e | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 29.940636463:10.017313314 +- 1e-7 | 3:0.9 | 3:0.9 | 10:11.1 |
| e,s | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 10.017313314:29.940636463 | 0.9:3 | 0.9:3 | 11.1:10 | | e,s | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 10.017313314:29.940636463 +- 1e-7 | 0.9:3 | 0.9:3 | 11.1:10 |
Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property

View File

@ -84,8 +84,9 @@ async function main() {
} }
catch (e) { catch (e) {
reply.code(400); reply.code(400);
// TODO: bindings do not return `message`, but put `code` into `message`
return { return {
code: e.code, code: e.message,
message: e.message message: e.message
}; };
} }

View File

@ -94,6 +94,7 @@ async function main() {
} catch (e: any) { } catch (e: any) {
reply.code(400); reply.code(400);
// TODO: bindings do not return `message`, but put `code` into `message`
return { return {
code: e.message, code: e.message,
message: e.message message: e.message