fix dns issue stress-test

This commit is contained in:
Gabriel Matte 2024-12-09 22:17:27 -05:00
parent a2d83f4f77
commit dd0f5f9534
5 changed files with 27 additions and 16 deletions

1
.gitignore vendored
View file

@ -130,6 +130,7 @@ dist
.pnp.*
db-backup/
.env
.venv
deployments
/test/stressTest/output

View file

@ -10,8 +10,6 @@ NUMBER_ROOMS=5
USERS_PER_ROOM=60
# Optionnal
MAX_MESSAGES_ROUND=20
CONVERSATION_INTERVAL=1000
MESSAGE_RESPONSE_TIMEOUT=5000

View file

@ -8,9 +8,18 @@ services:
dockerfile: Dockerfile
container_name: stress-test
network_mode: host
env_file:
- .env
#environment:
# - BASE_URL=http://127.0.0.1
# - USER_EMAIL=admin@admin.com
# - USER_PASSWORD=admin
# - NUMBER_ROOMS=5
# - USERS_PER_ROOM=60
# - MAX_MESSAGES_ROUND=20
# - CONVERSATION_INTERVAL=1000
# - MESSAGE_RESPONSE_TIMEOUT=5000
# - BATCH_DELAY=1000
# - BATCH_SIZE=10
#env_file:
# - .env
volumes:
- ./output:/app/output
tty: true
stdin_open: true

View file

@ -9,7 +9,7 @@ import generateMetricsReport from './utility/metrics_generator.js';
dotenv.config();
const config = {
baseUrl: process.env.BASE_URL || 'http://localhost',
baseUrl: process.env.BASE_URL || 'http://127.0.0.1',
auth: {
username: process.env.USER_EMAIL || 'admin@admin.com',
password: process.env.USER_PASSWORD || 'admin'

View file

@ -42,9 +42,13 @@ async function register(baseUrl, email, password) {
// Attempts to log in a user, or registers and logs in if the login fails.
export async function attemptLoginOrRegister(baseUrl, username, password) {
console.log(`Authenticating user with server : ${baseUrl}, username: ${username}, password: ${password}`);
try {
return await login(baseUrl, username, password);
} catch (loginError) {
console.error(`Login failed for ${username}:`, loginError.message);
}
console.log(`Login failed for ${username}. Attempting registration...`);
try {
await register(baseUrl, username, password);
@ -54,7 +58,6 @@ export async function attemptLoginOrRegister(baseUrl, username, password) {
return null;
}
}
}
// Creates a new room
export async function createRoomContainer(baseUrl, token) {