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

Adds the ability to pass included/ excluded tags to Locust. #17

Merged
merged 3 commits into from
Dec 15, 2023
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
6 changes: 6 additions & 0 deletions bin/load_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
});
7 changes: 5 additions & 2 deletions lib/constructs/locust_master_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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');
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lib/load_test_stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
});
Expand Down
Loading