adb-tests-artillery
Rôle
Suite de tests de charge et de validation API end-to-end basée sur Artillery.js. Cible la gateway publique (BE_HOST), s'authentifie via Keycloak, peuple/nettoie MongoDB directement, et vérifie le comportement des endpoints REST sous charge.
Lancée en pipeline Bitbucket avec différents profils (ENV_NAME, CLEANUP_BEFORE).
Stack
| Élément | Valeur |
|---|---|
| Artillery | 2.0.18 |
| Node.js | 23.6.1 (Alpine pour CI) ou 18.20.3 |
| MongoDB driver | mongodb 6.9.0 |
| Données de test | Google Sheets (google-spreadsheet) |
| Templating | Mustache |
Structure
adb-tests-artillery/
├── tests/
│ ├── 01-setup/ Récupération profils utilisateur
│ ├── 02-create/ CRUD : owner, tenant, supplier,
│ │ part, file, ticket, RDC, RC,
│ │ call-rc-first-rent, call-rc-regular-rent
│ └── 03-apicheck/ Validation API par domaine
│ ├── accounting/ ledger-account, accounting-entries,
│ │ ledger-auxiliary-account, accounting-event
│ └── persons/ tenant, person, organization
├── envs/ .env files par environnement
├── utils/ scripts utilitaires
│ ├── env-activation.mjs charge .env
│ ├── g-sheet.mjs extraction Google Sheets
│ ├── switching-data.mjs switching données
│ └── data-cleanup.mjs cleanup MongoDB
├── reports/ sortie Mochawesome (CI artifact)
├── config.yml config Artillery
└── bitbucket-pipelines.yml pipeline custom
Architecture du test
flowchart TB
PreSetup[Pre-setup<br/>g-sheet → fixtures]
Cleanup[Data cleanup<br/>MongoDB direct]
Auth[Auth Keycloak<br/>POST /realms/ADB/protocol/openid-connect/token]
Tests[Artillery scenarios]
Reports[reports/*.json<br/>format Mochawesome]
GS[Google Sheets<br/>GOOGLE_SHEET_ID]
Mongo[(MongoDB Atlas)]
KC[Keycloak]
Backend[adb-* via BE_HOST]
PreSetup --> GS
Cleanup --> Mongo
Auth --> KC
Tests --> Backend
Tests --> Reports
Variables d'environnement
| Variable | Rôle |
|---|---|
MONGO_DB_URL_<ENV_NAME> | Connection string MongoDB par env |
BE_HOST | URL backend (gateway) |
ADMIN_USERNAME / ADMIN_PASSWORD | Credentials admin Keycloak |
G_CONFIG | Credentials Google Sheets |
GOOGLE_SHEET_ID | ID de la feuille de données de test |
ENV_NAME | dev / athena / hephaestus / int |
CLEANUP_BEFORE | full / partial / no |
Commandes principales
npm run utils-activate-all # Setup complet
npm run utils-cleanup-all # Cleanup 13+ collections
npm run utils-cleanup-partial # Cleanup partiel
npm run create-all # Créer tous les éléments de test
npm run create-organization
npm run create-fiscal-year
npm run create-owner / tenant / supplier
npm run create-part / file / rdc / rc
npm run test-api-accounting # Tests API accounting
npm run test-api-persons
Chaque commande génère un rapport reports/*.json au format Mochawesome.
Pipeline Bitbucket
Custom pipeline (déclenchée manuellement) :
image: node:23.6.1-alpine
stages:
- npm install
- utils-activate-all
- cleanup (selon CLEANUP_BEFORE)
- exécution des scénarios Artillery
artifacts: reports/**
Scénarios principaux
- 01-setup — login admin, login représentant.
- 02-create — création complète d'un dataset : organisation, fiscal year, propriétaires, locataires, fournisseurs, comptes bancaires, parts, fichiers, tickets, contrats RDC et RC, premiers loyers et loyers récurrents.
- 03-apicheck — vérification des endpoints par domaine :
accounting/: ledger-account, accounting-entries, ledger-auxiliary-account, accounting-event.persons/: tenant, person, organization.
Liens
- Code :
adb-tests-artillery/ - Doc CFR stress test :
technical-epics/stress-test/i-can-stress-test-the-cfr.md - Rapports historiques :
technical-epics/stress-test/reports/