How sylvainomydoo/odoolocust works
Project type and purpose
• This is a Python-based load-testing library and sample suite for Odoo, built on top of Locust and odoolib.
• It ships as a reusable package (src/OdooLocust/…), plus sample test files and CRM-specific tasks.
File structure
• Top-level:
• setup.py, requirements.txt – package metadata and dependencies
• README.md – project overview and usage
• src/OdooLocust/… – actual library code
• test.py, test_sale.py – standalone tests
• src/OdooLocust:
• OdooLocustUser.py – subclass of Locust User, wraps odoolib client
• OdooTaskSet.py – generic TaskSet and CRM-specific TaskSets under crm/
• samples/ – example test scenarios and locust.conf
• The presence of locust.conf and shell scripts indicates master/worker orchestration and headless runs.
README for architecture hints
• Two core abstractions:
• OdooLocustUser (a Locust user that holds connection parameters)
• TaskSets (OdooTaskSet, OdooGenericTaskSet, crm.lead/partner/quotation)
• Integration points: users write subclasses, Locust drives them, they invoke odoolib over JSON-RPC to the Odoo server.
• Master/worker model for distributed load tests; configuration via locust.conf.
Main components
a. Locust Master (or headless master)
b. Locust Workers (one or many)
c. OdooLocust Library
• OdooLocustUser
• OdooTaskSet (generic + crm modules)
• Sample user scripts (Seller.py, load_odoo.py)
d. External Odoo Server
e. Configuration Layer (locust.conf / CLI args)
f. odoolib (the underlying RPC client)
Relationships and data flows
• Workers spawn greenlet Users (instances of OdooLocustUser).
• Each User uses its TaskSet(s) to execute tasks at runtime.
• Tasks call into OdooLocustUser.client (odoolib RPC client), issuing JSON-RPC over HTTP/S to the Odoo server.
• Responses flow back and feed into subsequent tasks.
• Master coordinates workers, aggregates results, exposes web UI or headless summary.
• Configuration (locust.conf or CLI) feeds host, user count, spawn rate, run time into Master/Workers.
Architectural patterns and principles
• Extension via subclassing: users extend OdooLocustUser & TaskSets.
• Modular services: clear separation between test harness (Locust) and RPC client (odoolib).
• Master/worker concurrency model using greenlets.
• Plug-and-play CRM modules in src/OdooLocust/crm.
Technologies, frameworks, libraries
• Python 3.x
• Locust (load-testing framework, master & workers)
• odoolib (Odoo RPC client)
• JSON-RPC / HTTP(S)
• gevent/greenlet (concurrency)
Diagramming recommendations
• Blue for internal modules (OdooLocustUser, TaskSets)
• Green for runtime engines (Locust master/workers)
• Orange for external services (Odoo server)
• Grey for configuration files/CLI
• From Master → Workers (control/coordination)
• From Workers → OdooLocustUser/TaskSet (instantiation)
• From TaskSet → odoolib client → Odoo server (RPC calls)
• From server → back to TaskSet → Master (metrics)
Essential details to capture
• Runtime model: Locust master and workers, headless vs UI mode.
• Extension mechanism: how sample scripts pick up OdooLocustUser & TaskSets.
• Communication flow: Task code → client → server → response.
• Configuration injection: locust.conf, environment defaults, CLI flags.