Skip to content

Commit

Permalink
chore: edit performanceTest sciprt
Browse files Browse the repository at this point in the history
  • Loading branch information
junha-ahn committed Nov 19, 2023
1 parent 08a3e39 commit 3d55b8a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/performanceTest/scripts/lib/request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import http from "k6/http";
import { sleep } from "k6";
import config from "./config.js";
import { randomInt } from "./helpers.js";

function parseQuery(query) {
if (query == null) {
Expand All @@ -27,7 +28,7 @@ export default class Request {
}

afterHook() {
sleep(this.SLEEP)
sleep(randomInt(this.SLEEP, this.SLEEP + 10))
}

setToken(token) {
Expand Down
3 changes: 2 additions & 1 deletion src/performanceTest/scripts/spikeTest/health_spikeTest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { check } from "k6";
import { check, sleep } from "k6";
import Request from "../lib/request.js";
import { encode } from "../lib/jwt.js";
import hooks from "../lib/hooks.js";
Expand Down Expand Up @@ -43,6 +43,7 @@ export default function () {
const ID = randomInt(1, 1000000)
req.setToken(encode(ID))

sleep(randomInt(0, 10))
for (let i = 0; i < 10; i++) {
check(req.helthCheck(), {"Success Health": isSuccess});
}
Expand Down
12 changes: 7 additions & 5 deletions src/performanceTest/scripts/spikeTest/queue_spikeTest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { check } from "k6";
import { check, sleep } from "k6";
import exec from 'k6/execution';
import Request from "../lib/request.js";
import { encode } from "../lib/jwt.js";
import hooks from "../lib/hooks.js";
Expand All @@ -24,9 +25,9 @@ export const options = {
scenarios: {
contacts: {
executor: 'per-vu-iterations',
vus: 1000,
vus: 2000,
iterations: 1,
maxDuration: '1m',
maxDuration: '2m',
},
},

Expand All @@ -48,9 +49,10 @@ export default function () {
page: 0,
sort: "id,asc"
}
for (let i = 0; i < 13; i++) {
sleep(randomInt(0, 10))
for (let i = 0; i < 5; i++) {
check(req.getEvents(query), {"Success Get Events": isSuccess});
query.page = query.page + randomInt(1, 10)
query.page = query.page + 3
}

const eventId = 98 // maxAttendees = 191
Expand Down

0 comments on commit 3d55b8a

Please sign in to comment.