From d616b51db670423093d3d4427507e0fb68b4e3e4 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 16 Oct 2026 10:04:21 -0400 Subject: [PATCH] Add devenv smoke script and Testing section to README Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs --- README.md | 8 ++++++++ devenv.nix | 1 + 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index a4e5d36..68b543d 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,14 @@ Metrics are polled every `metrics_interval_secs` (systemd unit active/failed/res ldd /usr/local/bin/slinuxm # libc, libm, libgcc_s, libsystemd and its dependencies only ``` +## Testing + +```sh +devenv shell -- smoke # same as: cargo test --test binary_smoke -- --nocapture +``` + +The smoke test runs the real built `slinuxm` binary against a throwaway SQLite database in a temp directory: it creates a token with the CLI, starts `serve` on a free loopback port, exercises `/healthz`, REST and MCP with and without the token, revokes the token, and checks a clean SIGTERM exit and a 0600 database. It needs no root and no network. Checks that depend on host data (systemd over D-Bus, the journal) are skipped with a printed reason when the source is unavailable; Docker is never required. + ## Development ```sh diff --git a/devenv.nix b/devenv.nix index 732ed50..7ed3bbe 100644 --- a/devenv.nix +++ b/devenv.nix @@ -18,6 +18,7 @@ scripts.build.exec = ''cargo build "$@"''; scripts.run.exec = ''cargo run -- "$@"''; + scripts.smoke.exec = "cargo test --test binary_smoke -- --nocapture"; scripts.token.exec = ''cargo run -- token "$@"''; enterShell = ''