Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/positions on island #76

Merged
merged 6 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 55 additions & 22 deletions le-taxi-api-tests/config/configs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Licensed under the AGPL-3.0 license.
// See LICENSE file in the project root for full license information.
import * as config from 'config';
import * as path from 'path';
import { ConfigCache } from './configCache';
import { constants } from './constants';
import * as config from "config";
import * as path from "path";
import { ConfigCache } from "./configCache";
import { constants } from "./constants";

/**
* Configurations for the application.
Expand All @@ -30,7 +30,9 @@ export class Configs {
private constructor() {
this.root = path.normalize(`${__dirname}/..`);
this.theEnvironment = config.util.getEnv(constants.EnvVariables.NODE_ENV);
this.theEnvironmentInstance = config.util.getEnv(constants.EnvVariables.NODE_APP_INSTANCE);
this.theEnvironmentInstance = config.util.getEnv(
constants.EnvVariables.NODE_APP_INSTANCE
);
this.cache = new ConfigCache();
}

Expand All @@ -54,12 +56,13 @@ export class Configs {
: this.theEnvironment,
type: this.theEnvironment,
instance: this.theEnvironmentInstance,
isLocal: this.cache.get<boolean>('environment.isLocal'),
isLocal: this.cache.get<boolean>("environment.isLocal"),
isDev: this.theEnvironment === constants.Environments.DEV,
isLocalOrDev:
this.cache.get<boolean>('environment.isLocal') || this.theEnvironment === constants.Environments.DEV,
this.cache.get<boolean>("environment.isLocal") ||
this.theEnvironment === constants.Environments.DEV,
isAcc: this.theEnvironment === constants.Environments.ACC,
isProd: this.theEnvironment === constants.Environments.PROD
isProd: this.theEnvironment === constants.Environments.PROD,
};
}

Expand All @@ -68,7 +71,25 @@ export class Configs {
*/
get e2eTesting() {
return {
maxTestConcurrency: this.cache.get<number>('e2eTesting.maxTestConcurrency')
maxTestConcurrency: this.cache.get<number>(
"e2eTesting.maxTestConcurrency"
),
};
}

/**
* Load testing informations
*/
get loadTesting() {
return {
snapshots: {
runWithTaxiExpiration: this.cache.get<number>(
"loadTesting.snapshots.runWithTaxiExpiration"
),
numberOfOperators: this.cache.get<number>(
"loadTesting.snapshots.numberOfOperators"
),
},
};
}

Expand All @@ -77,9 +98,9 @@ export class Configs {
*/
get apiTests() {
return {
rootApiKey: this.cache.get<string>('apiTests.rootApiKey'),
user: this.cache.get<string>('apiTests.user'),
password: this.cache.get<string>('apiTests.password')
rootApiKey: this.cache.get<string>("apiTests.rootApiKey"),
user: this.cache.get<string>("apiTests.user"),
password: this.cache.get<string>("apiTests.password"),
};
}

Expand All @@ -88,9 +109,15 @@ export class Configs {
*/
get inquiries() {
return {
delayToExceedPromotion: this.cache.get<number>('inquiries.delayToExceedPromotion'),
fixedDailyPriceDowntownToAirport: this.cache.get<number>('inquiries.fixedDailyPriceDowntownToAirport'),
fixedNightlyPriceDowntownToAirport: this.cache.get<number>('inquiries.fixedNightlyPriceDowntownToAirport')
delayToExceedPromotion: this.cache.get<number>(
"inquiries.delayToExceedPromotion"
),
fixedDailyPriceDowntownToAirport: this.cache.get<number>(
"inquiries.fixedDailyPriceDowntownToAirport"
),
fixedNightlyPriceDowntownToAirport: this.cache.get<number>(
"inquiries.fixedNightlyPriceDowntownToAirport"
),
};
}

Expand All @@ -99,7 +126,9 @@ export class Configs {
*/
get caching() {
return {
delayToExceedUsersCache: this.cache.get<number>('caching.delayToExceedUsersCache')
delayToExceedUsersCache: this.cache.get<number>(
"caching.delayToExceedUsersCache"
),
};
}

Expand All @@ -108,12 +137,16 @@ export class Configs {
*/
get taxiRegistryOsrmApi() {
return {
base: this.cache.get<string>('taxiRegistryOsrmApi.base'),
domainPath: this.cache.get<string>('taxiRegistryOsrmApi.domainPath'),
base: this.cache.get<string>("taxiRegistryOsrmApi.base"),
domainPath: this.cache.get<string>("taxiRegistryOsrmApi.domainPath"),
estimation: {
durationBias: this.cache.get<number>('taxiRegistryOsrmApi.estimation.durationBias'),
requestAndDispatchInSec: this.cache.get<number>('taxiRegistryOsrmApi.estimation.requestAndDispatchInSec')
}
durationBias: this.cache.get<number>(
"taxiRegistryOsrmApi.estimation.durationBias"
),
requestAndDispatchInSec: this.cache.get<number>(
"taxiRegistryOsrmApi.estimation.requestAndDispatchInSec"
),
},
};
}
}
Expand All @@ -122,7 +155,7 @@ export let configs: Configs = Configs.instance;

export function getAbsoluteUrl(relative: string): string {
if (configs.environment.isDev) {
return `https://taximtldev.accept.ville.montreal.qc.ca${relative}`;
return `https://taximtl.accept.ville.montreal.qc.ca${relative}`;
}

// Default value in LOCAL
Expand Down
9 changes: 8 additions & 1 deletion le-taxi-api-tests/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ inquiries:
fixedNightlyPriceDowntownToAirport: 56.70 # Airport night fixed rate + compensation
caching:
delayToExceedUsersCache: 11
#==========================================
# Load testing
#==========================================
loadTesting:
snapshots:
runWithTaxiExpiration: false
numberOfOperators: 50

#==========================================
# Routing Service OSRM
Expand All @@ -37,4 +44,4 @@ taxiRegistryOsrmApi:
distanceDailyRateRatio: 0.95 # Ratio for the average daily distance rate calculated against Polytechnic's
distanceNightlyRateRatio: 1.03 # Ratio for the average nightly distance rate calculated against Polytechnic's
dailyCompensationRate: 6.07 # Day fixed rate + compensations
nightlyCompensationRate: 6.67 # Night fixed rate + compensations
nightlyCompensationRate: 6.67 # Night fixed rate + compensations
Loading