From 71353669ca70496e5c12872160efc0687c0befc1 Mon Sep 17 00:00:00 2001 From: Gabriel Matte Date: Wed, 27 Nov 2024 21:09:24 -0500 Subject: [PATCH] adds env to main --- test/stressTest/main.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/test/stressTest/main.js b/test/stressTest/main.js index b99a58d..47188cc 100644 --- a/test/stressTest/main.js +++ b/test/stressTest/main.js @@ -2,17 +2,23 @@ import { attemptLoginOrRegister, createRoomContainer } from './utility/apiServic import { Student } from './class/student.js'; import { Teacher } from './class/teacher.js'; import { Watcher } from './class/watcher.js'; +import dotenv from 'dotenv'; -const BASE_URL = 'http://localhost'; -const user = { username: 'admin@example.com', password: 'adminPassword' }; -const numberRooms = 10; -const usersPerRoom = 60; +// Load environment variables +dotenv.config(); + +const BASE_URL = process.env.BASE_URL || 'http://localhost'; +const user = { + username: process.env.USER_EMAIL || 'admin@admin.com', + password: process.env.USER_PASSWORD || 'admin' +}; +const numberRooms = parseInt(process.env.NUMBER_ROOMS || '5'); +const usersPerRoom = parseInt(process.env.USERS_PER_ROOM || '60'); const roomAssociations = {}; -const maxMessages = 20; -const conversationInterval = 1000; -const batchSize = 20; -const batchDelay = 250; - +const maxMessages = parseInt(process.env.MAX_MESSAGES || '20'); +const conversationInterval = parseInt(process.env.CONVERSATION_INTERVAL || '1000'); +const batchSize = 10; // Number of simultaneous connections +const batchDelay = 500; /** * Creates a room and immediately connects a teacher to it.