Add RabbitMQ validation, test scaffolding, and config refactor

- Extract ipl() from main() with env-aware error handling (fatal in prod, warn in dev)
- Add amqp::validate() — TCP reachability check for RabbitMQ at IPL
- Refactor config::load() into load() + load_from() for testability
- Add lib.rs to expose public API to integration test harness
- Add test fixture scaffolding: tests/fixtures/beds_test.toml, tests/common/mod.rs
- Add unit tests for amqp::validate() error paths (closed port, bad address)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 19:32:24 -07:00
parent 8a89fe3403
commit c1d1ff14a5
6 changed files with 343 additions and 11 deletions

51
tests/fixtures/beds_test.toml vendored Normal file
View File

@@ -0,0 +1,51 @@
# =============================================================================
# BEDS Test Fixture — beds_test.toml
# =============================================================================
#
# Canonical configuration fixture for all BEDS unit and integration tests.
# Values here are test-safe: localhost services, known ports, no real creds.
#
# Load via tests/common/mod.rs::load_test_config() — do not call
# config::load() directly from tests, as that reads the live config/beds.toml.
#
# AUTHOR: mks
# VERSION: 1.0
#
# HISTORY:
# ========
# 2026-04-02 mks original coding
# =============================================================================
debug = true
syslog = false
syslog_mirror_console = true
audit_on = false
journal_on = false
[id]
env_name = "dev"
version = "1.0"
wbid = "ms"
[broker_services]
queue_tag = "test_"
vhost = "test"
timer_violation = 3000
records_per_xfer = 5000
keepalive = true
heartbeat = 60
use_ssl = false
cert_path = "/etc/rabbitmq"
[broker_services.app_server]
host = "127.0.0.1"
port = 5672
api_port = 15672
user = "beds"
pass = "changeme"
rpi = 50
[broker_services.app_server.instances]
r_broker = 2
w_broker = 2
m_broker = 0