mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
fix dns issue stress-test
This commit is contained in:
parent
a2d83f4f77
commit
dd0f5f9534
5 changed files with 27 additions and 16 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -130,6 +130,7 @@ dist
|
||||||
.pnp.*
|
.pnp.*
|
||||||
db-backup/
|
db-backup/
|
||||||
|
|
||||||
|
.env
|
||||||
.venv
|
.venv
|
||||||
deployments
|
deployments
|
||||||
/test/stressTest/output
|
/test/stressTest/output
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ NUMBER_ROOMS=5
|
||||||
USERS_PER_ROOM=60
|
USERS_PER_ROOM=60
|
||||||
|
|
||||||
# Optionnal
|
# Optionnal
|
||||||
|
|
||||||
|
|
||||||
MAX_MESSAGES_ROUND=20
|
MAX_MESSAGES_ROUND=20
|
||||||
CONVERSATION_INTERVAL=1000
|
CONVERSATION_INTERVAL=1000
|
||||||
MESSAGE_RESPONSE_TIMEOUT=5000
|
MESSAGE_RESPONSE_TIMEOUT=5000
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,18 @@ services:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: stress-test
|
container_name: stress-test
|
||||||
network_mode: host
|
network_mode: host
|
||||||
env_file:
|
#environment:
|
||||||
- .env
|
# - 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:
|
volumes:
|
||||||
- ./output:/app/output
|
- ./output:/app/output
|
||||||
tty: true
|
|
||||||
stdin_open: true
|
|
||||||
|
|
@ -9,7 +9,7 @@ import generateMetricsReport from './utility/metrics_generator.js';
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
baseUrl: process.env.BASE_URL || 'http://localhost',
|
baseUrl: process.env.BASE_URL || 'http://127.0.0.1',
|
||||||
auth: {
|
auth: {
|
||||||
username: process.env.USER_EMAIL || 'admin@admin.com',
|
username: process.env.USER_EMAIL || 'admin@admin.com',
|
||||||
password: process.env.USER_PASSWORD || 'admin'
|
password: process.env.USER_PASSWORD || 'admin'
|
||||||
|
|
|
||||||
|
|
@ -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.
|
// Attempts to log in a user, or registers and logs in if the login fails.
|
||||||
export async function attemptLoginOrRegister(baseUrl, username, password) {
|
export async function attemptLoginOrRegister(baseUrl, username, password) {
|
||||||
|
console.log(`Authenticating user with server : ${baseUrl}, username: ${username}, password: ${password}`);
|
||||||
try {
|
try {
|
||||||
return await login(baseUrl, username, password);
|
return await login(baseUrl, username, password);
|
||||||
} catch (loginError) {
|
} catch (loginError) {
|
||||||
|
console.error(`Login failed for ${username}:`, loginError.message);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`Login failed for ${username}. Attempting registration...`);
|
console.log(`Login failed for ${username}. Attempting registration...`);
|
||||||
try {
|
try {
|
||||||
await register(baseUrl, username, password);
|
await register(baseUrl, username, password);
|
||||||
|
|
@ -54,7 +58,6 @@ export async function attemptLoginOrRegister(baseUrl, username, password) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Creates a new room
|
// Creates a new room
|
||||||
export async function createRoomContainer(baseUrl, token) {
|
export async function createRoomContainer(baseUrl, token) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue