1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! Shared `sandbox-it` test scaffolding for the module integration tests: registers
//! both backend providers once per test binary and lets `RIGHTSIZE_BACKEND` (set by
//! the caller — see each test file's module doc for the invocation) pick which one
//! `Container::start()` resolves to, exactly the path a real caller uses.
//!
//! Each test binary is its own process, and `rightsize::backends::active()` caches
//! its resolution for the lifetime of that process — so running the same suite twice
//! with different `RIGHTSIZE_BACKEND` values (once per backend, to cover both) means
//! two separate `cargo test` invocations, not two branches inside one test.
//!
//! `tests/support/mod.rs` is compiled fresh into every `tests/*.rs` binary via `mod
//! support;` (each integration-test file is its own crate root), so a helper only
//! some of those binaries call is genuinely dead code from any one binary's own
//! point of view — each call site's `mod support;` carries `#[allow(dead_code)]` for
//! exactly that reason, rather than chasing per-binary warnings for a file that's
//! shared by construction.
use BackendProvider;
use DockerBackendProvider;
use MsbBackendProvider;
/// Registers both providers through the crate's own public entry point — the same
/// call every module `start` makes — so these tests exercise the exact registration
/// path a real caller gets. Does NOT force a default `RIGHTSIZE_BACKEND` — unlike
/// the backend crates' own single-backend ITs, module ITs are meant to run once per
/// backend via an explicit `RIGHTSIZE_BACKEND=...` invocation (see each test file's
/// module doc), so silently defaulting here would mask a caller forgetting to set it.
/// True if the backend named by `RIGHTSIZE_BACKEND` (or the highest-priority
/// supported one, if unset) is actually usable on this host. Every module IT test
/// should open with `require_backend!()` so it skips itself (rather than failing)
/// when this host has neither runtime available.
/// Skips the calling test (prints a notice and returns) unless the requested backend
/// is available on this host. Expects `mod support;` (or an equivalent path prefix)
/// to be in scope at the call site — each `tests/*.rs` file is its own crate root, so
/// this can't be `#[macro_export]`-ed the way an in-crate macro would be; each test
/// file defines its own thin `require_backend!()` wrapper calling
/// `support::requested_backend_available()` instead.
/// A `ureq` agent with an explicit whole-request timeout, for module ITs that poll an
/// HTTP endpoint. `ureq`'s own default has no global timeout at all — a container
/// that accepts the connection but replies slowly (or a chunked body that never
/// finishes) can otherwise hang a single `.call()` well past any surrounding retry
/// loop's intended budget, which is exactly what happened diagnosing the Redpanda
/// schema-registry smoke (a real, reproducible 503 on this image/version, not a
/// timing fluke — see `broker_modules_it.rs`).
/// A minimal, dependency-free base64 encoder — just enough for a `Basic` auth header
/// value. `base64` is only a *transitive* dependency of this workspace (pulled in by
/// other crates' own deps), and Rust doesn't let a crate `use` a dependency it hasn't
/// declared directly, so hand-rolling ~10 lines here keeps every module IT's own
/// `Cargo.toml` footprint at zero, matching the house preference for small
/// hand-rolled encoders over a new direct dependency (see `rightsize-docker/src/json.rs`).
/// Shared here rather than copy-pasted per-file (was duplicated verbatim across
/// `rabbitmq_it.rs`, `clickhouse_it.rs`, and `neo4j_it.rs`).