Testing¶
The platform ships with a self-contained integration test platform under usr/share/tests/backend/. This section is the tester-facing manual: what kind of testing is supported today, how to run each kind, and where to look when something fails. All commands below are run from that directory.
At a glance¶
| Kind of test | Status | Entry point | Detail |
|---|---|---|---|
| Regression | Shipped — 78 tests across 8 flows | ./run_tests.sh |
Regression |
| User Acceptance (UAT) | Shipped — same harness, scenario-style fixtures | ./run_tests.sh --flow subscriber (or any business-readable subset) |
UAT |
| Stress / load | Shipped — four scenarios (S-01..S-04) with per-scenario thresholds and markdown reports | ./run_stress.sh --scenario S-01 --bring-up |
Stress |
| Deployment acceptance | Shipped — 3 tests (prepaid, postpaid, CRM) in usr/share/tests/e2e/, also packed standalone |
../e2e/run_e2e.sh --crm-url URL |
Deployment acceptance |
How the test platform is organised¶
graph LR
subgraph TS["usr/share/tests/backend/"]
Runner["run_tests.sh<br/>(regression CLI)"]
Stress["run_stress.sh<br/>(stress CLI)"]
Lib["lib/<br/>(db, crm_client, diameter_client,<br/>cdr_writer, refdata, verbose)"]
Flow1["tests/flow1_cdr_rating/ (14)"]
Flow2["tests/flow2_diameter/ (19)"]
Flow3["tests/flow3_invoice/ (11)"]
Flow4["tests/flow4_subscriber/ (15)"]
Flow5["tests/flow5_mediation/ (3)"]
Flow6["tests/flow6_roaming/ (6)"]
Flow7["tests/flow7_catalogue/ (7)"]
Flow8["tests/flow8_e2e/ (2)"]
Scenarios["stress/scenarios/<br/>(S-01..S-04)"]
end
subgraph Platform["bin/server roles"]
Prepaid["prepaid (DIAMETER)"]
CDR["cdr_loader"]
Bill["billing1..4"]
Fmt["bill_formatter"]
Med["mediation"]
Roam["roaming"]
CRM["crm (gRPC)"]
end
DB[("MySQL")]
PDF[("var/spool/invoice/")]
TAP[("var/spool/tapout/")]
Runner --> Lib
Stress --> Scenarios
Lib --> Flow1 & Flow2 & Flow3 & Flow4 & Flow5 & Flow6 & Flow7 & Flow8
Flow1 -- ".cdr files" --> CDR
Flow2 -- "raw RFC 6733 / bin/diameter_client" --> Prepaid
Flow3 -- "ExecuteBilling / ExecuteBillCycle (gRPC)" --> CRM
Flow3 -- "polls" --> Fmt
Flow4 -- "Subscriber RPCs" --> CRM
Flow5 -- ".grur files" --> Med
Flow6 -- "roaming spool / visitor RPCs" --> Roam
Flow7 -- "catalogue RPCs" --> CRM
Flow8 -- "CRM RPCs + mediation spool" --> CRM
CDR --> DB
Prepaid --> DB
Bill --> DB
Fmt --> DB
Fmt --> PDF
Med --> Roam
Roam --> DB
Roam --> TAP
CRM --> DB
- Two CLI entry points.
run_tests.shdrives the regression / UAT pytest suite (translates--stage/--flow/--bring-up/--reportinto a pytest invocation);run_stress.shdrives the stress scenarios (--scenario/--all/--bring-up/--count/--threads/--thresholds/--reports-dir). Both default to "platform already up; just run";--bring-upadds a kill/start/wait/run/stop wrapper. - Six fixture modules in
lib/(db,crm_client,diameter_client,cdr_writer,refdata,verbose) cover everything the tests need to reach the platform. Tests never carry credentials — fixtures read them from the environment loaded bydev_env.sh. - Eight flow directories mirror the externally observable surfaces: Flow 1 = CDR rating, Flow 2 = DIAMETER, Flow 3 = invoice, Flow 4 = subscriber lifecycle, Flow 5 = mediation, Flow 6 = roaming charging + settlement, Flow 7 = product catalogue, Flow 8 = end-to-end convergent-billing use-cases. Each test file is a single scenario; the same harness carries regression and UAT scenarios side by side. (
tests/test_timing_probes.pyadds one cross-cutting probe, for a total of 78.) The license-issuer tests (tests/licensing/, markerslicense/pkcs11/yubikey) are documented under Licensing. - Four stress scenarios in
stress/scenarios/(S-01CDR-loader saturation,S-02DIAMETER parallel CCR storm,S-03bulk rating pass,S-04bill-cycle scale-out). Each records measurements against pass/fail thresholds instress/thresholds.tomland emits a markdown report (default$BSS_HOME/var/log/stress/, overridable with--reports-dir).
What every kind of testing shares¶
These conventions are binding for any test you author or run, regardless of category:
- Reserved MSISDN prefix
40799scopes every test-emitted row / CDR / balance reserve / bill / activity / notification. The session-end cleanup deletes only inside this prefix, so test data never touches operator data. - Test-owned price plans are prefixed
TEST_. The running rater / loader / billing roles refresh their reference-data cache on every tick (5 s default), so a plan inserted at test time is visible within one tick — write the plan, sleep one tick, then exercise the rater. - Verbose tag set — every test prints
[TEST]/[SETUP]/[SEND]/[RECV]/[INFO]/[ASSERT]/[TEARDOWN]/[RESULT]lines with ANSI colour (auto-detected from TTY; respectsNO_COLOR). - Per-test teardown is mandatory for
subscriber,balance,resource,granted_free_units,used_free_units, roaming/visitor rows, andBillFormatter-sourced notifications. The session-end_suite_cleanuponly sweeps a fixed set of tables; tests that pollute outside that set are responsible for their own rows. - Non-conformity tracking. When a test surfaces a platform deviation, capture it in
./.claude/NON_CONFORMITIES.mdas a newNC-Nentry, referenced from the test that found it. The convention is documented inCLAUDE.md.
Where to start¶
- "I want to run the regression": Regression.
- "I want to run / write a UAT scenario": UAT.
- "I want to drive load against the platform": Stress.
- "I want to know what bugs the suite found that are still open":
./.claude/NON_CONFORMITIES.md.
Prerequisites (shared)¶
| Component | Required | Notes |
|---|---|---|
| MySQL 8.0+ | yes | Seeded via the three ordered usr/src/sql/billing_0{1,2,3}_*.sql files + usr/src/sql/crm/crm_auth.sql. X DevAPI port (33060) is used by the engine; the classic port (3306) is used by the test db fixture via MICROBSS_TEST_DB_PORT. |
| Python 3.11+ | yes | Tested up to Python 3.15. The pinned deps (pytest, grpcio/protobuf matching the generated stubs, PyMySQL, PyJWT) install via pip install -e . from usr/share/tests/backend/. Recreate .venv after a Python upgrade — a virtualenv is tied to the interpreter that built it. |
| Platform binary | yes | bin/server + bin/diameter_client + bin/cdr_generator. Built + installed per the Installation guide. |
pdftotext (poppler) |
optional | Used by the multi-currency PDF test for high-confidence assertions. Falls back to raw byte read if missing. |
One-time install of the test virtualenv:
The environment (DB credentials + the file-backed JWT/PAN secrets the gRPC tests need) is loaded by dev_env.sh; run_tests.sh --bring-up sources it for you. When invoking pytest directly, source it first: