ores.testing

Table of Contents

1. Diagram

ores.testing component diagram

Figure 1: ores.testing

2. Summary

ores.testing is the shared infrastructure every ORE Studio test suite builds on. Each test run gets its own PostgreSQL tenant inside one shared database, so parallel suites cannot see each other's rows, and the tenant is terminated when the run ends. The component routes Boost.Log output per test case, hands out database contexts bound to the test tenant, and reads the SQL populate scripts so that a suite asserts against the seed the loader actually writes. Its consumers are the test binaries of the production components, never production code.

3. Inputs

  • ORES_TEST_DB_* environment variables (or .env) with the database user, password, host, database, port and tenant.
  • ORES_TEST_LOG_ENABLED, ORES_TEST_LOG_LEVEL, ORES_TEST_LOG_CONSOLE and ORES_TEST_LOG_DATABASE, which switch per-test logging on and choose where it goes.
  • ORES_TEST_TIMEOUT_SECONDS, the per-test watchdog budget, 60 seconds by default.
  • ORES_NATS_URL and the ORES_NATS_TLS_* trio, read into NATS connection options.
  • A Catch2 test runner that registers the listeners and sets its module name.
  • The populate scripts under projects/ores.sql/populate/, read through project_root.

4. Outputs

  • A provisioned test tenant per run, terminated at the end of that run.
  • Boost.Log records per test case under ../log/<module>/<suite>, written to a file and optionally to the console and to the telemetry database.
  • Database contexts bound to the test tenant, optionally carrying a minimal RBAC seed and party-scoped isolation.
  • Domain objects parsed from a populate script, for a suite that asserts against the seed.

5. Entry points

  • include/ores.testing/ores.testing.hpp — the namespace documentation header.
  • include/ores.testing/database_lifecycle_listener.hpp — provisions and terminates the test tenant.
  • include/ores.testing/logging_listener.hpp — per-test Boost.Log routing.
  • include/ores.testing/database_helper.hpp — tenant context, RBAC seed and party scope.
  • include/ores.testing/scoped_database_helper.hpp — the RAII wrapper a test declares.
  • include/ores.testing/make_generation_context.hpp — generation contexts for codegen tests.
  • include/ores.testing/run_coroutine_test.hpp — drives one coroutine to completion and fails the case when it throws.

6. Dependencies

  • Catch2 — the framework the listeners plug into.
  • ores.database — the connection pool, and the tenant and party contexts.
  • ores.logging — the logger factory every test translation unit calls, and the lifecycle manager the per-test listener drives.
  • ores.nats — the connection options make_nats_options() builds.
  • ores.platform — environment access and the local-time conversion behind a test tenant code.
  • ores.utility — the tenant identifier the helpers hand out, and the generation context they build.
  • ores.marketdata.api and ores.ore.core — the domain types the seed readers return.
  • ores.telemetry.core and ores.telemetry.database — the log lifecycle manager and the telemetry sink.

7. See also

Emacs 29.3 (Org mode 9.6.15)