Testing
6 posts on Testing.

sqlx Offline Mode: Building in Docker and CI With No Database in Sight
sqlx's query! macros check every query against a live Postgres at compile time, so a plain docker build fails. How I build with SQLX_OFFLINE and a committed .sqlx folder, the .env that quietly turned it off, and the schema change that compiled fine and panicked at runtime.
12 min read

JSON Logs in Rust, With the Level in a Config File Instead of RUST_LOG
Structured JSON logs with tracing in a Rust backend: a log level read from the same TOML file as everything else, fields instead of sentences, the error that only shows up in tests, and the rule for which errors deserve a log line.
6 min read

Liveness vs Readiness in Axum, and the Health Check That Always Said OK
My readiness endpoint answered 200 with the database gone, because a handler with no return type answers 200. Two health checks in axum that mean different things, an empty 503, and tests that call the router without opening a port.
5 min read

My Rust Backend Exited With Code 0 While the Database Was Down
The database was down, the backend printed nothing and exited 0. Three small mistakes with map_err, unwrap and a missing .await made a failing service look healthy. How errors should travel up to main, and the one test that catches it.
6 min read

My Rust Backend Refuses to Start With a Bad Config File, On Purpose
One TOML file, read once at startup, and the backend doesn't start if a single key is wrong. Why I picked TOML, how serde does most of the validation, why the log level is an enum, and the error message that printed my whole config file.
7 min read

I Ran My GDPR Logging Schema and It Found Three Bugs in a Day
Designing a healthcare logging schema on paper is easy. Booting it exposed a hashed-user count that was quietly wrong, a device fingerprint that walked straight past redaction, and a TTL test that proved a caveat I had only written down.
8 min read