Skip to content

Commit 53f2da5

Browse files
Implement NodeJS based server fully replicating osrm-routed
1 parent c1d2c15 commit 53f2da5

37 files changed

+4313
-445
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 441 additions & 439 deletions
Large diffs are not rendered by default.

cucumber.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ module.exports = {
33
verify: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only -f progress --require features/support --require features/step_definitions',
44
todo: '--strict --tags @todo --require features/support --require features/step_definitions',
55
all: '--strict --require features/support --require features/step_definitions',
6-
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@ch --require features/support --require features/step_definitions -f progress'
6+
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@ch --require features/support --require features/step_definitions -f progress',
7+
verify_routed_js: '--strict --tags ~@skip_on_routed_js --tags ~@stress --tags ~@todo --tags ~@mld-only -f progress --require features/support --require features/step_definitions',
8+
mld_routed_js: '--strict --tags ~@skip_on_routed_js --tags ~@stress --tags ~@todo --tags ~@ch --require features/support --require features/step_definitions -f progress',
79
};

features/options/routed/help.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Feature: osrm-routed command line options: help
44
Background:
55
Given the profile "testbot"
66

7+
@skip_on_routed_js
78
Scenario: osrm-routed - Help should be shown when no options are passed
89
When I run "osrm-routed"
910
Then stderr should be empty
@@ -24,6 +25,7 @@ Feature: osrm-routed command line options: help
2425
And stdout should contain "--max-matching-size"
2526
And it should exit successfully
2627

28+
@skip_on_routed_js
2729
Scenario: osrm-routed - Help, short
2830
When I run "osrm-routed -h"
2931
Then stderr should be empty
@@ -44,6 +46,8 @@ Feature: osrm-routed command line options: help
4446
And stdout should contain "--max-matching-size"
4547
And it should exit successfully
4648

49+
50+
@skip_on_routed_js
4751
Scenario: osrm-routed - Help, long
4852
When I run "osrm-routed --help"
4953
Then stderr should be empty

features/options/routed/invalid.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Feature: osrm-routed command line options: invalid options
44
Background:
55
Given the profile "testbot"
66

7+
@skip_on_routed_js
78
Scenario: osrm-routed - Non-existing option
89
When I try to run "osrm-routed --fly-me-to-the-moon"
910
Then stdout should be empty

features/step_definitions/requests.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ module.exports = function () {
3333
callback();
3434
});
3535

36+
this.Then(/^HTTP code should be (\d+)$/, (code, callback) => {
37+
assert(this.response.statusCode, parseInt(code));
38+
callback();
39+
});
40+
3641
this.Then(/^status message should be "(.*?)"$/, (message, callback) => {
3742
try {
3843
this.json = JSON.parse(this.response.body);

features/support/env.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ module.exports = function () {
1515
this.setDefaultTimeout(this.TIMEOUT);
1616
this.ROOT_PATH = process.cwd();
1717

18+
this.USE_ROUTED_JS = process.env.OSRM_USE_ROUTED_JS || false;
19+
1820
this.TEST_PATH = path.resolve(this.ROOT_PATH, 'test');
1921
this.CACHE_PATH = path.resolve(this.TEST_PATH, 'cache');
2022
this.LOGS_PATH = path.resolve(this.TEST_PATH, 'logs');
@@ -40,7 +42,7 @@ module.exports = function () {
4042

4143
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
4244
this.OSRM_IP = process.env.OSRM_IP || '127.0.0.1';
43-
this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 10;
45+
this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 100;
4446
this.OSRM_CONNECTION_EXP_BACKOFF_COEF = process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF && parseFloat(process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF) || 1.0;
4547

4648
this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`;

features/support/run.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ module.exports = function () {
3939

4040
this.runBin = (bin, options, env, callback) => {
4141
let cmd = path.resolve(util.format('%s/%s%s', this.BIN_PATH, bin, this.EXE));
42+
if (this.USE_ROUTED_JS && bin === 'osrm-routed') {
43+
cmd = 'osrm-routed-js';
44+
}
4245
let opts = options.split(' ').filter((x) => { return x && x.length > 0; });
46+
4347
let log = fs.createWriteStream(this.scenarioLogFile, {'flags': 'a'});
4448
log.write(util.format('*** running %s %s\n', cmd, options));
4549
// we need to set a large maxbuffer here because we have long running processes like osrm-routed

features/testbot/load.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Feature: Ways of loading data
3232
Then stderr should be empty
3333
And it should exit successfully
3434

35+
@skip_on_routed_js
3536
Scenario: osrm-datastore - Fail if no shared memory blocks are loaded
3637
When I run "osrm-datastore --spring-clean" with input "Y"
3738
And I try to run "osrm-routed --shared-memory=1"

features/testbot/snap_intersection.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ Feature: Snapping at intersections
570570
| a,f,k | ac,cf,cf,fj,kj,kj | 132.8s | 132.8 |
571571
| k,f | ik,fi,fi | 54.3s | 54.3 |
572572
| f,a | ef,ae,ae | 66.6s | 66.6 |
573-
| k,f,a | kj,fj,fj,ef,ae,ae | 141.399999999s | 141.399999999 |
573+
| k,f,a | kj,fj,fj,ef,ae,ae | 141.399999999s +- 1e-7 | 141.399999999 +- 1e-7 |
574574

575575
When I request a travel time matrix I should get
576576
| | a | f | k |
@@ -626,4 +626,4 @@ Feature: Snapping at intersections
626626
| a,f,k | ad,df,df,fj,kj,kj | 105.6s | 105.6 |
627627
| k,f | ik,fi,fi | 54.3s | 54.3 |
628628
| f,a | ef,ae,ae | 66.6s | 66.6 |
629-
| k,f,a | ik,fi,fi,ef,ae,ae | 120.899999999s | 120.899999999 |
629+
| k,f,a | ik,fi,fi,ef,ae,ae | 120.899999999s +- 1e-7 | 120.899999999 +- 1e-7 |

features/testbot/status.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Feature: Status messages
3939
| a | c | | 400 | Impossible route between points |
4040
| b | d | | 400 | Impossible route between points |
4141

42+
@skip_on_routed_js
4243
Scenario: Malformed requests
4344
Given the node locations
4445
| node | lat | lon |

0 commit comments

Comments
 (0)