diff --git a/bin/load_test.ts b/bin/load_test.ts index 861265f..693d237 100644 --- a/bin/load_test.ts +++ b/bin/load_test.ts @@ -23,4 +23,10 @@ new LoadTestStack(app, 'LoadTestStack', { // You can enable basic auth for Locust web UI uncommenting lines below: // webUsername: 'admin', // webPassword: 'passw0rd', + + // Any arbitrary command line options to pass to Locust. + // An example would be: + // Exclude Tags - List of tags to exclude from the test, so only tasks + // with no matching tags will be executed. + // additionalArguments: ['--exclude-tags', 'tag1', 'tag2'], }); diff --git a/lib/constructs/locust_master_service.ts b/lib/constructs/locust_master_service.ts index 8ee33ce..bcd039b 100644 --- a/lib/constructs/locust_master_service.ts +++ b/lib/constructs/locust_master_service.ts @@ -14,6 +14,7 @@ export interface LocustMasterServiceProps { readonly certificateArn?: string; readonly allowedCidrs: string[]; readonly logBucket: IBucket; + readonly additionalArguments?: string[]; readonly webUsername?: string; readonly webPassword?: string; } @@ -25,7 +26,7 @@ export class LocustMasterService extends Construct { constructor(scope: Construct, id: string, props: LocustMasterServiceProps) { super(scope, id); - const { cluster, webUsername, webPassword } = props; + const { cluster, additionalArguments, webUsername, webPassword } = props; const configMapName = 'master'; const image = new ecs.AssetImage('app'); @@ -47,7 +48,9 @@ export class LocustMasterService extends Construct { command.push('--web-auth'); command.push(`${webUsername}:${webPassword}`); } - + if (additionalArguments != null) { + command.push(...additionalArguments); + } masterTaskDefinition.addContainer('locust', { image, command, diff --git a/lib/load_test_stack.ts b/lib/load_test_stack.ts index 8e49c6d..c866e2c 100644 --- a/lib/load_test_stack.ts +++ b/lib/load_test_stack.ts @@ -11,6 +11,7 @@ import { ServiceLinkedRole } from 'upsert-slr'; interface LoadTestStackProps extends StackProps { readonly allowedCidrs: string[]; readonly certificateArn?: string; + readonly additionalArguments?: string[]; readonly webUsername?: string; readonly webPassword?: string; } @@ -57,6 +58,7 @@ export class LoadTestStack extends Stack { certificateArn: props.certificateArn, allowedCidrs: props.allowedCidrs, logBucket, + additionalArguments: props.additionalArguments, webUsername: props.webUsername, webPassword: props.webPassword, });