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.*
|
||||
db-backup/
|
||||
|
||||
.env
|
||||
.venv
|
||||
deployments
|
||||
/test/stressTest/output
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ NUMBER_ROOMS=5
|
|||
USERS_PER_ROOM=60
|
||||
|
||||
# Optionnal
|
||||
|
||||
|
||||
MAX_MESSAGES_ROUND=20
|
||||
CONVERSATION_INTERVAL=1000
|
||||
MESSAGE_RESPONSE_TIMEOUT=5000
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -53,7 +57,6 @@ export async function attemptLoginOrRegister(baseUrl, username, password) {
|
|||
console.error(`Registration and login failed for ${username}:`, registerError.message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Creates a new room
|
||||
|
|
|
|||
Loading…
Reference in a new issue