Skip to content

Commit

Permalink
feat: rework osrm tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu <[email protected]>

feat: add missing license

Signed-off-by: Matthieu <[email protected]>

feat: increase performance test to 2 hours

Signed-off-by: Matthieu <[email protected]>
  • Loading branch information
mtlmatt committed Jul 17, 2024
1 parent e0a4258 commit 7e1995d
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 58 deletions.
3 changes: 1 addition & 2 deletions le-taxi-api-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"load-test-optional-trigger-many-errors-alert": "tsc && node node_modules/artillery/bin/artillery run src/taxis/loadTests/test-trigger-many-errors-alert.yaml",
"load-test-taxi-position-snapshot-data-dump": "tsc && node node_modules/artillery/bin/artillery run -o test-taxi-position-snapshot-data-dump.report.json src/taxiPositionSnapshotDataDumps/loadTests/test-taxi-position-snapshot-data-dump.yaml && node node_modules/artillery/bin/artillery report -o test-taxi-position-snapshot-data-dump.report.html test-taxi-position-snapshot-data-dump.report.json",
"load-test-taxi-grid": "tsc && node node_modules/artillery/bin/artillery run -o test-taxi-grid.report.json src/taxis/loadTests/test-taxi-grid.yaml && node node_modules/artillery/bin/artillery report -o test-taxi-grid.report.html test-taxi-grid.report.json",
"load-test-osrm": "tsc && node node_modules/artillery/bin/artillery run -o test-osrm.report.json src/osrm/loadTests/test-osrm.yaml && node node_modules/artillery/bin/artillery report -o test-osrm.report.html test-osrm.report.json",
"generate-load-test-shared-state": "env NODE_ENV=development npm run launch-generate-load-test-shared-state",
"generate-integration-tests-shared-state": "env NODE_ENV=development npm run launch-generate-integration-tests-shared-state",
"clean": "rimraf src/**/*.js src/**/*.js.map",
Expand All @@ -25,8 +26,6 @@
"prettier": "villemontreal-lint . check node prettier",
"prettier-fix": "villemontreal-lint . fix node prettier",
"tsc": "tsc",
"osrm-random-montreal-car-route-5rps": "tsc && node node_modules/artillery/bin/artillery run -o osrm-random-montreal-car-route-5rps.report.json src/osrm/osrm-random-montreal-car-route-5rps.yaml && node node_modules/artillery/bin/artillery report -o osrm-random-montreal-car-route-5rps.report.html osrm-random-montreal-car-route-5rps.report.json",
"osrm-random-montreal-car-route-20rps": "tsc && node node_modules/artillery/bin/artillery run -o osrm-random-montreal-car-route-20rps.report.json src/osrm/osrm-random-montreal-car-route-20rps.yaml && node node_modules/artillery/bin/artillery report -o osrm-random-montreal-car-route-20rps.report.html osrm-random-montreal-car-route-20rps.report.json",
"launch-generate-load-test-shared-state": "tsc && node -r source-map-support/register src/taxis/loadTests/generateMotor.sharedState.js && node -r source-map-support/register src/taxiPositionSnapShots/loadTests/generateTaxis.sharedState.js",
"launch-generate-integration-tests-shared-state": "tsc && node -r source-map-support/register src/apiIntegrationTests/generateApiIntegration.sharedState.js",
"launch-load-tests": "node node_modules/artillery/bin/artillery run -o load-tests-results.json artillery.yaml"
Expand Down
23 changes: 0 additions & 23 deletions le-taxi-api-tests/src/osrm/generateOsrmPayload.ts

This file was deleted.

26 changes: 26 additions & 0 deletions le-taxi-api-tests/src/osrm/loadTests/generateOsrmPayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed under the AGPL-3.0 license.
// See LICENSE file in the project root for full license information.
import { getRandomNumberBetween } from "../../shared/commonLoadTests/randomData";
import { generatePointForLoadTest } from "../../shared/commonLoadTests/specialRegion";

// tslint:disable-next-line: no-console
console.log(
"WARNING: ALL LOAD TESTS MUST BE EXECUTED WITH A SINGLE REPLICA PER DEPLOYMENT!"
);

export function beforeGetRoute(context: any, ee: any, next: any) {
const source = generatePointForLoadTest();
const dest = generatePointForLoadTest();
context.vars.taxiLat = source.lat;
context.vars.taxiLon = source.lon;
context.vars.clientLat = addOffset(source.lat);
context.vars.clientLon = addOffset(source.lon);
context.vars.destinationLat = dest.lat;
context.vars.destinationLon = dest.lon;
return next();
}

function addOffset(value: number) {
const offset = getRandomNumberBetween(-0.015, 0.015);
return value + offset;
}
16 changes: 16 additions & 0 deletions le-taxi-api-tests/src/osrm/loadTests/test-osrm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
config:
target: "https://api.accept.interne.montreal.ca/api/taxi/taxi-registry-osrm"
processor: "./generateOsrmPayload.js"
http:
pool: 1000
timeout: 35
phases:
- name: "load test"
arrivalRate: 1000
duration: 300
scenarios:
- name: "OSRM test"
flow:
- function: "beforeGetRoute"
- get:
url: "/route/v1/car/{{taxiLon}},{{taxiLat}};{{clientLon}},{{clientLat}};{{destinationLon}},{{destinationLat}}?overview=false"

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Licensed under the AGPL-3.0 license.
// See LICENSE file in the project root for full license information.
// Original Code from https://github.com/apburnes/random-points-on-polygon
"use strict";

var extent = require("turf-extent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ config:
timeout: 35
phases:
- name: "1 800 inquiries"
arrivalRate: 100
arrivalRate: 90
duration: 300
scenarios:
- name: "GOFS realtime_booking"
Expand Down

0 comments on commit 7e1995d

Please sign in to comment.