diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2026-02-15 21:27:00 +0100 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2026-02-15 21:27:00 +0100 |
| commit | ce0dbf6b249956700c6a1705bf4ad85a09d53e8c (patch) | |
| tree | d7c3236807cfbf75d7f3a355eb5df5a5e2cc4ad7 /src/test_support.rs | |
| parent | 064a1d01c5c14f5ecc032fa9b8346a4a88b893f6 (diff) | |
Switch, cleanup, and status CLI commands. Persistent build state via
state.json. Post-deploy hooks on success and failure with
WITRYNA_BUILD_STATUS. Dependency diet (axum→tiny_http, clap→argh,
tracing→log). Drop built-in rate limiting. Nix flake with NixOS module.
Arch Linux PKGBUILD. Centralized version management.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/test_support.rs')
| -rw-r--r-- | src/test_support.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/test_support.rs b/src/test_support.rs index 8f2d2bf..d6a0a96 100644 --- a/src/test_support.rs +++ b/src/test_support.rs @@ -7,24 +7,21 @@ #![allow(clippy::unwrap_used, clippy::expect_used)] -use crate::server::{AppState, run_with_listener}; -use anyhow::Result; +use crate::server::{AppState, run_with_server}; use std::path::{Path, PathBuf}; -use tokio::net::TcpListener; +use std::sync::Arc; +use tiny_http::Server; -/// Start the HTTP server on the given listener, shutting down when `shutdown` resolves. +/// Start the HTTP server, returning a `JoinHandle` for the request-handling thread. /// -/// The server behaves identically to production — same middleware, same handlers. -/// -/// # Errors -/// -/// Returns an error if the server encounters a fatal I/O error. -pub async fn run_server( +/// The server shuts down when `shutdown` resolves (calls `server.unblock()`). +/// Callers should join the handle after triggering shutdown. +pub fn run_server( state: AppState, - listener: TcpListener, + server: Arc<Server>, shutdown: impl std::future::Future<Output = ()> + Send + 'static, -) -> Result<()> { - run_with_listener(state, listener, shutdown).await +) -> std::thread::JoinHandle<()> { + run_with_server(state, server, shutdown) } /// Install the SIGHUP configuration-reload handler for `state`. |
