camel_integration_test/lib.rs
1//! Integration-tier test support for rust-camel (ADR-0069).
2//!
3//! This crate owns the scenario model: the parsing of `.test.yaml`
4//! documents that declare a `scenario:` section, the ordered action
5//! vocabulary (`send`, `receive`, `sleep`, `validate`), endpoint
6//! references with partner provisioning, and the document-level rules
7//! that keep the scenario vocabulary separate from the unit-tier
8//! vocabulary (`inputs`, `expects`, `intercepts`).
9//!
10//! The tier derivation, the layered environment source, the action
11//! runner, and the partner adapters are built on the model types
12//! defined here.
13//!
14//! The system under test is always an embedded boot. The harness never
15//! drives a deployed `camel run` process.
16
17pub mod adapters;
18pub mod boot_scenario;
19pub mod document;
20pub mod env_layers;
21/// Inbound listener provisioning (feature `http`, rc-5yon): binds
22/// `127.0.0.1:0` and stages the listener on the HTTP component's
23/// global registry (ADR-0070) before the scenario boot, so the route
24/// consumer consumes the staged socket.
25#[cfg(feature = "http")]
26pub mod inbound;
27/// Process-global log capture (rc-tdgh5): the capture subscriber, the
28/// open windows, and the captured events behind the scenario tier's
29/// document-level `logs:` assertions. The harness claims the process's
30/// tracing seat before the composition root's boot (first-wins
31/// `try_init`); when it owns the seat, `log_capture::CaptureLayer`
32/// attributes every event to every open window whose
33/// `[opened_at, now)` interval contains the event timestamp.
34pub mod log_capture;
35pub mod runner;
36pub mod sql_action;
37pub mod tier;
38
39/// Partner-script grammar of the scenario document's `partners:` map;
40/// its public types are re-exported through [`crate::document`].
41mod partner_script;
42
43#[cfg(feature = "http")]
44pub use adapters::http::{HttpPartner, HttpRecorder, HttpWireRequest, ScriptedResponse};
45pub use adapters::{
46 DirectStimulus, FakeAdapter, FakeRecorder, IncomingMessage, OutgoingMessage, PartnerAdapter,
47 PartnerRouter, ReceiveError, ReceiveTimeout, RecordedSend, TransportError,
48};
49pub use boot_scenario::{ScenarioRun, boot_scenario};
50pub use camel_matchers::RequestExpectation as PartnerExpectation;
51pub use camel_matchers::{CountBound, Expectation, PathFilter, RowsExpectation};
52#[cfg(feature = "http")]
53pub use document::partner_scripts_for;
54pub use document::{
55 DocError, EndpointRef, InboundListener, PartnerFault, PartnerScript, PartnerScriptResponse,
56 Provisioning, RouteSource, ScenarioAction, ScenarioDocument, ScenarioTarget, SqlTarget,
57 ValidateExpectation, parse_scenario_document,
58};
59pub use env_layers::{AmbientLookup, LayeredEnv, ambient_std};
60#[cfg(feature = "http")]
61pub use inbound::provision_inbound;
62pub use log_capture::{LogEvent, WindowHandle, capture_installed, ensure_capture_subscriber};
63pub use runner::{
64 DocumentOutcome, ScenarioFailure, ScenarioVars, ScenarioVerdict, run_scenario,
65 run_scenario_document,
66};
67#[cfg(feature = "sql")]
68pub use sql_action::execute_sql_prepare;
69pub use sql_action::{
70 RawSqlAction, SQL_ACTION_KEY, SQL_MEMORY_NOT_SHARED, SqlAction, ensure_sqlite_memory_shared,
71 is_read_statement, sanitize_db_error, validate_sql_action,
72};
73pub use tier::{DocumentInputs, Tier, derive_tier};
74
75/// Scenario document parser contract tests (the six named tests from
76/// the task brief plus the validate and regex-gate tests).
77#[cfg(test)]
78mod doc_parse_test;
79
80/// Layered environment tests (the three named tests from task 2.3).
81#[cfg(test)]
82mod env_layers_test;
83
84/// Scenario action runner tests (the four named tests from task 2.4).
85#[cfg(test)]
86mod runner_test;
87
88/// boot_scenario delegation tests (the six named tests from task 3.1,
89/// scenario-shared-boot).
90#[cfg(test)]
91mod boot_scenario_test;
92
93/// Partner router address-math tests (the pure wire_target /
94/// lane_key_for cases).
95#[cfg(test)]
96mod adapters_test;
97
98/// HTTP partner adapter tests (the named tests from task 3.1).
99#[cfg(all(test, feature = "http"))]
100mod http_partner_test;
101
102/// Scenario `sql:` action executor tests (bd rc-25lup.1).
103#[cfg(all(test, feature = "sql"))]
104mod sql_action_test;
105
106/// Shared cfg(test) SQLite stub-catalog support (bd rc-mu3aq): stub
107/// pool factory, catalog builder, and seed helpers for the sql test
108/// modules.
109#[cfg(all(test, feature = "sql"))]
110mod sql_stub;
111
112/// `validate` sql-target executor tests (bd rc-25lup.2, task 3.1):
113/// the poll lattice, projection, mismatch redaction, and the
114/// feature-off twin. Compiles in BOTH feature configurations — the
115/// test bodies split internally per config.
116#[cfg(test)]
117mod sql_validate_test;