mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-16 23:43:10 +00:00
fix(test): disable worktrees in fabro-server integration tests
Server scenario tests were inheriting the default local sandbox worktree mode, which meant they created git worktrees and branches before stage execution. Under suite load that setup intermittently stalled the run long enough for the scenario polling windows to fail. Disable worktrees in the shared server test settings and let lifecycle scenarios use the same test-only settings through a settings-aware registry factory helper.
This commit is contained in:
parent
5f6a5ced6b
commit
dad418f95d
3 changed files with 30 additions and 6 deletions
|
|
@ -509,9 +509,20 @@ pub fn create_app_state() -> Arc<AppState> {
|
|||
#[doc(hidden)]
|
||||
pub fn create_app_state_with_registry_factory(
|
||||
registry_factory_override: impl Fn(Arc<dyn Interviewer>) -> HandlerRegistry + Send + Sync + 'static,
|
||||
) -> Arc<AppState> {
|
||||
create_app_state_with_settings_and_registry_factory(
|
||||
Settings::default(),
|
||||
registry_factory_override,
|
||||
)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn create_app_state_with_settings_and_registry_factory(
|
||||
settings: Settings,
|
||||
registry_factory_override: impl Fn(Arc<dyn Interviewer>) -> HandlerRegistry + Send + Sync + 'static,
|
||||
) -> Arc<AppState> {
|
||||
build_app_state(
|
||||
Arc::new(RwLock::new(Settings::default())),
|
||||
Arc::new(RwLock::new(settings)),
|
||||
Some(Box::new(registry_factory_override)),
|
||||
5,
|
||||
test_store(),
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use fabro_server::server::{
|
|||
AppState, build_router, create_app_state, create_app_state_with_options, spawn_scheduler,
|
||||
};
|
||||
use fabro_types::Settings;
|
||||
use fabro_types::settings::{LocalSandboxSettings, SandboxSettings, WorktreeMode};
|
||||
use tower::ServiceExt;
|
||||
|
||||
pub(crate) const MINIMAL_DOT: &str = r#"digraph Test {
|
||||
|
|
@ -24,10 +25,22 @@ pub(crate) fn test_app_state() -> Arc<AppState> {
|
|||
create_app_state()
|
||||
}
|
||||
|
||||
pub(crate) fn test_settings() -> Settings {
|
||||
Settings {
|
||||
sandbox: Some(SandboxSettings {
|
||||
local: Some(LocalSandboxSettings {
|
||||
worktree_mode: WorktreeMode::Never,
|
||||
}),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn dry_run_settings() -> Settings {
|
||||
Settings {
|
||||
dry_run: Some(true),
|
||||
..Default::default()
|
||||
..test_settings()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
use axum::body::Body;
|
||||
use axum::http::{Request, StatusCode};
|
||||
use fabro_interview::Interviewer;
|
||||
use fabro_server::server::{build_router, create_app_state_with_registry_factory};
|
||||
use fabro_server::server::{build_router, create_app_state_with_settings_and_registry_factory};
|
||||
use fabro_workflow::handler::HandlerRegistry;
|
||||
use fabro_workflow::handler::agent::AgentHandler;
|
||||
use fabro_workflow::handler::exit::ExitHandler;
|
||||
|
|
@ -12,7 +12,7 @@ use fabro_workflow::handler::start::StartHandler;
|
|||
use tower::ServiceExt;
|
||||
|
||||
use crate::helpers::{
|
||||
POLL_ATTEMPTS, POLL_INTERVAL, api, body_json, run_json, wait_for_run_status,
|
||||
POLL_ATTEMPTS, POLL_INTERVAL, api, body_json, run_json, test_settings, wait_for_run_status,
|
||||
wait_for_run_status_not_in,
|
||||
};
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ const GATE_DOT: &str = r#"digraph GateTest {
|
|||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn full_http_lifecycle_approve_and_complete() {
|
||||
let state = create_app_state_with_registry_factory(gate_registry);
|
||||
let state = create_app_state_with_settings_and_registry_factory(test_settings(), gate_registry);
|
||||
fabro_server::server::spawn_scheduler(Arc::clone(&state));
|
||||
let app = build_router(
|
||||
Arc::clone(&state),
|
||||
|
|
@ -133,7 +133,7 @@ async fn full_http_lifecycle_approve_and_complete() {
|
|||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn full_http_lifecycle_cancel() {
|
||||
let state = create_app_state_with_registry_factory(gate_registry);
|
||||
let state = create_app_state_with_settings_and_registry_factory(test_settings(), gate_registry);
|
||||
fabro_server::server::spawn_scheduler(Arc::clone(&state));
|
||||
let app = build_router(
|
||||
Arc::clone(&state),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue