Skip to content

Commit

Permalink
added variation to numberofvus
Browse files Browse the repository at this point in the history
  • Loading branch information
Parbir committed Mar 4, 2024
1 parent 17f2faf commit 76f103c
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 2 deletions.
29 changes: 29 additions & 0 deletions scripts/numberofVUs/constantVUs/10VUs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

import http from 'k6/http';
import { group, sleep } from 'k6';

const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`;

const groupResponseTimes = {};

export const options = {
discardResponseBodies: true,
scenarios: {
blackTeaBrowse: {
executor: 'constant-vus',
vus: 10,
duration: '30s',
},
},
};

export default function () {
group('Black Tea Category Browse', () => {
const start = new Date();
http.get(`${BASE_URL}/category?category=2&page=1`);
const end = new Date();
const duration = end - start;
groupResponseTimes['Black Tea Category Browse'] = (groupResponseTimes['Black Tea Category Browse'] || 0) + duration;
sleep(1);
});
}
29 changes: 29 additions & 0 deletions scripts/numberofVUs/constantVUs/50VUs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

import http from 'k6/http';
import { group, sleep } from 'k6';

const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`;

const groupResponseTimes = {};

export const options = {
discardResponseBodies: true,
scenarios: {
blackTeaBrowse: {
executor: 'constant-vus',
vus: 50,
duration: '30s',
},
},
};

export default function () {
group('Black Tea Category Browse', () => {
const start = new Date();
http.get(`${BASE_URL}/category?category=2&page=1`);
const end = new Date();
const duration = end - start;
groupResponseTimes['Black Tea Category Browse'] = (groupResponseTimes['Black Tea Category Browse'] || 0) + duration;
sleep(1);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import http from 'k6/http';
import { group, sleep } from 'k6';

const BASE_URL = `http://10.1.10.210:8080/tools.descartes.teastore.webui`;
const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`;

const groupResponseTimes = {};

Expand Down
38 changes: 38 additions & 0 deletions scripts/numberofVUs/rampingVUs/ramping2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

import http from 'k6/http';
import { group, sleep } from 'k6';

const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`;

const groupResponseTimes = {};

//Spikes
export const options = {
discardResponseBodies: true,
scenarios: {
blackTeaBrowse: {
executor: 'ramping-vus',
startVUs: 0,
stages: [
{ duration: '30s', target: 70 },
{ duration: '10s', target: 0 },
{ duration: '20s', target: 80 },
{ duration: '10s', target: 0 },
{ duration: '20s', target: 100 },
{ duration: '10s', target: 0 },
],
gracefulRampDown: '0s',
},
},
};

export default function () {
group('Black Tea Category Browse', () => {
const start = new Date();
http.get(`${BASE_URL}/category?category=2&page=1`);
const end = new Date();
const duration = end - start;
groupResponseTimes['Black Tea Category Browse'] = (groupResponseTimes['Black Tea Category Browse'] || 0) + duration;
sleep(1);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import http from 'k6/http';
import { group, sleep } from 'k6';

const BASE_URL = `http://10.1.10.210:8080/tools.descartes.teastore.webui`;
const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`;

const groupResponseTimes = {};

Expand Down

0 comments on commit 76f103c

Please sign in to comment.