Skip to content

Commit

Permalink
Using stages to ramp up load
Browse files Browse the repository at this point in the history
  • Loading branch information
anshulrr committed Sep 23, 2020
1 parent 5cef3e4 commit c4fe77e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/flows/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ export const setup = () => setup_flow()
export default function (data: any) {
let access_token = data.access_token;
let contacts = data.contacts;
let contact_index = __VU - 1
// Temporary fix to get different contact for all tests
let contact_index = __VU * 10 + __ITER

test_help_flow(access_token, contacts[contact_index])
}

function test_help_flow(access_token: string, contact: any) {
let flow_keyword = "help"
let response = inbound_message(flow_keyword, contact)
inbound_message(flow_keyword, contact)
sleep_delay()

let search_query_response = search_query(access_token, contact);
Expand All @@ -38,7 +39,7 @@ function test_help_flow(access_token: string, contact: any) {
search_query_response.search[0].messages[0].body !== flow_keyword
});

response = inbound_message("2", contact)
inbound_message("2", contact)
sleep_delay()

search_query_response = search_query(access_token, contact);
Expand Down
2 changes: 1 addition & 1 deletion src/flows/new_contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const setup = () => setup_flow()
export default function (data: any) {
let access_token = data.access_token;
let contacts = data.contacts;
let contact_index = __VU - 1
let contact_index = __VU * 10 + __ITER

test_new_contact_flow(access_token, contacts[contact_index])
}
Expand Down
8 changes: 5 additions & 3 deletions src/flows/test_any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import test_other_flow_keywords from "./test_other_flow_keywords";
// For now keeping vus and iterations same,
// so that different tests don't start for same contact
export let options: Options = {
vus: 10,
iterations: 10,
thresholds: {
'http_req_duration': ['p(95) < 400'] // threshold on a standard metric
}
},
stages: [
{ duration: '30s', target: 5 },
{ duration: '30s', target: 10 },
],
};

export const setup = () => setup_flow()
Expand Down
2 changes: 1 addition & 1 deletion src/flows/test_other_flow_keywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const setup = () => setup_flow()
export default function (data: any) {
let access_token = data.access_token;
let contacts = data.contacts;
let contact_index = __VU - 1
let contact_index = __VU * 10 + __ITER

test_new_contact_with_other_flow_keywords(access_token, contacts[contact_index])
}
Expand Down
2 changes: 1 addition & 1 deletion src/flows/test_wrong_input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const setup = () => setup_flow()
export default function (data: any) {
let access_token = data.access_token;
let contacts = data.contacts;
let contact_index = __VU - 1
let contact_index = __VU * 10 + __ITER

test_help_flow_with_wrong_input(access_token, contacts[contact_index])
}
Expand Down

0 comments on commit c4fe77e

Please sign in to comment.