Artillery cleanup

This commit is contained in:
David Négrier 2020-09-18 17:36:33 +02:00
parent 7826b2ea8d
commit 30d2a25501
3 changed files with 1 additions and 100 deletions

View File

@ -38,10 +38,8 @@ async function startOneUser(): Promise<void> {
} }
(async () => { (async () => {
let promises: Promise<void>[] = new Array<Promise<void>>();
for (let userNo = 0; userNo < 40; userNo++) { for (let userNo = 0; userNo < 40; userNo++) {
promises.push(startOneUser()); startOneUser();
// Wait 0.5s between adding users // Wait 0.5s between adding users
await sleep(500); await sleep(500);
} }

View File

@ -1,44 +0,0 @@
config:
target: "http://api.workadventure.localhost/"
socketio:
transports: ["websocket"]
query:
token: "test"
phases:
- duration: 20
arrivalRate: 3
processor: "./socketioLoadTest.js"
scenarios:
- name: "Connects and moves player for 20 seconds"
weight: 90
engine: "socketio"
flow:
- emit:
channel: "set-player-details"
data:
name: 'TEST'
characterLayers: ['male3']
- think: 1
- emit:
channel: "join-room"
data:
roomId: 'global__maps.workadventure.localhost/Floor0/floor0'
position:
x: 783
y: 170
direction: 'down'
moving: false
viewport:
left: 500
top: 0
right: 800
bottom: 200
- think: 1
- loop:
- function: "setUserMovesMessage"
- emit:
channel: "user-position"
data: "{{ message }}"
- think: 0.2
count: 100
- think: 10

View File

@ -1,53 +0,0 @@
'use strict';
require("../messages/generated/messages_pb");
//import {PositionMessage, UserMovesMessage, ViewportMessage} from "../messages/generated/messages_pb";
module.exports = {
setYRandom
};
function setYRandom(context, events, done) {
if (context.angle === undefined) {
context.angle = Math.random() * Math.PI * 2;
}
context.angle += 0.05;
context.vars.x = 320 + 1472/2 * (1 + Math.sin(context.angle));
context.vars.y = 200 + 1090/2 * (1 + Math.cos(context.angle));
context.vars.left = context.vars.x - 320;
context.vars.top = context.vars.y - 200;
context.vars.right = context.vars.x + 320;
context.vars.bottom = context.vars.y + 200;
return done();
}
function setUserMovesMessage(context, events, done) {
if (context.angle === undefined) {
context.angle = Math.random() * Math.PI * 2;
}
context.angle += 0.05;
const x = Math.floor(320 + 1472/2 * (1 + Math.sin(context.angle)));
const y = Math.floor(200 + 1090/2 * (1 + Math.cos(context.angle)));
const positionMessage = new PositionMessage();
positionMessage.setX(x);
positionMessage.setY(y);
positionMessage.setDirection(PositionMessage.Direction.UP);
positionMessage.setMoving(false);
const viewportMessage = new ViewportMessage();
viewportMessage.setTop(y - 200);
viewportMessage.setBottom(y + 200);
viewportMessage.setLeft(x - 320);
viewportMessage.setRight(x + 320);
const userMovesMessage = new UserMovesMessage();
userMovesMessage.setPosition(positionMessage);
userMovesMessage.setViewport(viewportMessage);
context.vars.message = userMovesMessage.serializeBinary().buffer;
console.log(context.vars.message);
return done();
}