Fix flaky server tests by using explicit dry_run settings

These tests were racing against pipeline initialization (git worktree
creation, status checks) that runs before discovering no API keys and
falling back to dry-run mode. Using dry_run_settings() skips the
unnecessary git work upfront.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-31 12:16:52 -04:00
parent 501399cc8f
commit 04ba232961
No known key found for this signature in database
2 changed files with 11 additions and 4 deletions

View file

@ -2057,7 +2057,7 @@ mod tests {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn run_completes_and_status_is_completed() {
let state = create_app_state(test_db().await);
let state = create_app_state_with_options(test_db().await, dry_run_settings(), 5);
let app = test_app_with_scheduler(state);
// Start a run
@ -2235,7 +2235,7 @@ mod tests {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn aggregate_usage_increments_after_run_completes() {
let state = create_app_state(test_db().await);
let state = create_app_state_with_options(test_db().await, dry_run_settings(), 5);
let app = test_app_with_scheduler(state);
// Start a run

View file

@ -773,7 +773,7 @@ mod serve_dry_run {
use axum::body::Body;
use axum::http::{Request, StatusCode};
use fabro_server::server::{build_router, create_app_state};
use fabro_server::server::{build_router, create_app_state_with_options};
use tower::ServiceExt;
const MINIMAL_DOT: &str = r#"digraph Test {
@ -785,7 +785,14 @@ mod serve_dry_run {
/// Build the router exactly as `serve_command` does in dry-run mode.
async fn dry_run_app() -> axum::Router {
let state = create_app_state(test_db().await);
let state = create_app_state_with_options(
test_db().await,
fabro_config::FabroSettings {
dry_run: Some(true),
..Default::default()
},
5,
);
fabro_server::server::spawn_scheduler(Arc::clone(&state));
build_router(state, fabro_server::jwt_auth::AuthMode::Disabled)
}