-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/performanceTest/scripts/smokeTest/queue_reservationCheck.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { check } from "k6"; | ||
import Request from "../lib/request.js"; | ||
import generator from "../lib/generator.js"; | ||
import hooks from "../lib/hooks.js"; | ||
import { getOneFromList, isRunningQueueTicket } from "../lib/helpers.js"; | ||
|
||
export const setup = hooks.setup | ||
export const handleSummary = hooks.handleSummary | ||
|
||
export default function () { | ||
const req = new Request() | ||
|
||
const USERID = 1 | ||
const user = generator.User(USERID) | ||
req.signup(user) | ||
req.signin(user) | ||
const event = getOneFromList(req.getEvents().json().data) | ||
const res1 = req.createQueueTicket(event.id, USERID) | ||
|
||
check(res1, { "createQueueTicket status == 201": (r) => r.status == 201 }); | ||
|
||
while (!isRunningQueueTicket(req.getQueueTicket(event.id, USERID))) {} | ||
|
||
const res2 = req.createReservation(generator.Reservation(event.id)) | ||
console.log(res2) | ||
check(res2, { "createReservation status == 201": (r) => r.status == 201 }); | ||
check(res2, { "createReservation.eventId == event.id": (r) => r.json().data.eventId == event.id }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { check } from "k6"; | ||
import Request from "../lib/request.js"; | ||
import { encode } from "../lib/jwt.js"; | ||
import hooks from "../lib/hooks.js"; | ||
import generator from "../lib/generator.js"; | ||
import { isSuccess, randomInt, isAlreadReservedAll, isRunningQueueTicket } from "../lib/helpers.js"; | ||
|
||
export const setup = hooks.setup | ||
export const handleSummary = hooks.handleSummary | ||
|
||
export const options = { | ||
tags: { | ||
testid: `${__ENV.ENTRYPOINT}` | ||
}, | ||
ext: { | ||
loadimpact: { | ||
apm: [ | ||
{ | ||
includeTestRunId: true, | ||
} | ||
] | ||
} | ||
}, | ||
scenarios: { | ||
contacts: { | ||
executor: 'per-vu-iterations', | ||
vus: 200, | ||
iterations: 1, | ||
maxDuration: '1m', | ||
}, | ||
}, | ||
|
||
thresholds: { | ||
http_req_failed: ['rate<0.01'], // http errors should be less than 1% | ||
http_req_duration: ['p(95)<300'], // 95% of requests should be below 300ms | ||
}, | ||
}; | ||
|
||
|
||
export default function () { | ||
const req = new Request() | ||
|
||
const ID = randomInt(1, 1000000) | ||
req.setToken(encode(ID)) | ||
|
||
const query = { | ||
size: 20, | ||
page: 0, | ||
sort: "id,asc" | ||
} | ||
for (let i = 0; i < 13; i++) { | ||
check(req.getEvents(query), {"Success Get Events": isSuccess}); | ||
query.page = query.page + randomInt(1, 10) | ||
} | ||
|
||
const eventId = 98 // maxAttendees = 191 | ||
check(req.getEvent(eventId), {"EVENT 98 maxAttendees = 191": (r) => r.json().data.maxAttendees === 191}) | ||
|
||
const res1 = req.createQueueTicket(eventId, ID) | ||
check(res1, { "createQueueTicket status == 201": (r) => r.status == 201 }); | ||
|
||
while (!isRunningQueueTicket(req.getQueueTicket(eventId, ID))) {} | ||
|
||
|
||
const res = req.createReservation(generator.Reservation(eventId)) | ||
check(res, {"Success Reservation": isSuccess}); | ||
check(res, {"Already reserved": isAlreadReservedAll}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters