Skip to content

Commit eb97bb1

Browse files
authored
minor fix for chatty-users load test (#1321)
1 parent 9e20ab4 commit eb97bb1

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

tests/load/chatty-users.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getAuthToken, randomRoomNames, createRoom, HOSTNAME } from "./utils.js"
55

66
export const options = {
77
// A number specifying the number of VUs to run concurrently.
8-
vus: 2,
8+
vus: 20,
99
// A string specifying the total duration of the test run.
1010
// duration: "10s",
1111

tests/load/utils.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,31 @@ export function createRoom(name, token, roomOptions = {}, options = { doCheck: t
4949
const body = Object.assign(
5050
{
5151
name: name,
52-
visibility: "public",
53-
isTemporary: false,
5452
},
5553
roomOptions
5654
);
5755
const url = `http://${HOSTNAME}/api/room/create`;
58-
let resp = http.post(url, JSON.stringify(body), {
56+
let resp = http.post(url, body, {
5957
headers: {
6058
Authorization: `Bearer ${token}`,
6159
},
6260
});
6361
if (options.doCheck) {
64-
check(resp, { "room created": r => r && r.status === 201 });
62+
check(resp, {
63+
"room created": r => {
64+
if (r.status === 201) {
65+
return true;
66+
}
67+
let body = JSON.parse(r.body);
68+
if (body.error && body.error.name === "RoomNameTakenException") {
69+
return true;
70+
}
71+
return false;
72+
},
73+
});
74+
}
75+
76+
if (resp.status !== 201) {
77+
console.log(`Failed to create room ${name}: ${resp.body}`);
6578
}
6679
}

0 commit comments

Comments
 (0)