diff --git a/lib/crates/fabro-agent/tests/guardrails.rs b/lib/crates/fabro-agent/tests/it/guardrails.rs similarity index 100% rename from lib/crates/fabro-agent/tests/guardrails.rs rename to lib/crates/fabro-agent/tests/it/guardrails.rs diff --git a/lib/crates/fabro-agent/tests/it/main.rs b/lib/crates/fabro-agent/tests/it/main.rs new file mode 100644 index 000000000..3ffb1e7e2 --- /dev/null +++ b/lib/crates/fabro-agent/tests/it/main.rs @@ -0,0 +1,2 @@ +mod guardrails; +mod parity_matrix; diff --git a/lib/crates/fabro-agent/tests/parity_matrix.rs b/lib/crates/fabro-agent/tests/it/parity_matrix.rs similarity index 100% rename from lib/crates/fabro-agent/tests/parity_matrix.rs rename to lib/crates/fabro-agent/tests/it/parity_matrix.rs diff --git a/lib/crates/fabro-api/tests/integration.rs b/lib/crates/fabro-api/tests/it/api.rs similarity index 95% rename from lib/crates/fabro-api/tests/integration.rs rename to lib/crates/fabro-api/tests/it/api.rs index 1636764b2..aa9581e70 100644 --- a/lib/crates/fabro-api/tests/integration.rs +++ b/lib/crates/fabro-api/tests/it/api.rs @@ -422,6 +422,7 @@ mod mtls_e2e { // =========================================================================== mod server_lifecycle { + use super::super::helpers::{test_db, test_llm_spec}; use std::sync::Arc; use std::time::Duration; @@ -434,19 +435,8 @@ mod server_lifecycle { use fabro_workflows::handler::exit::ExitHandler; use fabro_workflows::handler::human::HumanHandler; use fabro_workflows::handler::start::StartHandler; - use fabro_workflows::pipeline::LlmSpec; use tower::ServiceExt; - fn test_llm_spec() -> LlmSpec { - LlmSpec { - model: "test-model".to_string(), - provider: fabro_llm::Provider::Anthropic, - fallback_chain: Vec::new(), - mcp_servers: Vec::new(), - dry_run: true, - } - } - fn gate_registry(interviewer: Arc) -> HandlerRegistry { let mut registry = HandlerRegistry::new(Box::new(AgentHandler::new(None))); registry.register("start", Box::new(StartHandler)); @@ -477,12 +467,6 @@ mod server_lifecycle { revise -> gate }"#; - async fn test_db() -> sqlx::SqlitePool { - let pool = fabro_db::connect_memory().await.unwrap(); - fabro_db::initialize_db(&pool).await.unwrap(); - pool - } - #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn full_http_lifecycle_approve_and_complete() { let state = @@ -631,26 +615,16 @@ mod server_lifecycle { // =========================================================================== mod sse_events { + use super::super::helpers::{test_db, test_llm_spec}; use std::sync::Arc; use std::time::Duration; use axum::body::Body; use axum::http::{Request, StatusCode}; use fabro_api::server::{build_router, create_app_state}; - use fabro_workflows::pipeline::LlmSpec; use http_body_util::BodyExt; use tower::ServiceExt; - fn test_llm_spec() -> LlmSpec { - LlmSpec { - model: "test-model".to_string(), - provider: fabro_llm::Provider::Anthropic, - fallback_chain: Vec::new(), - mcp_servers: Vec::new(), - dry_run: true, - } - } - const SIMPLE_DOT: &str = r#"digraph SSETest { graph [goal="Test SSE"] start [shape=Mdiamond] @@ -659,12 +633,6 @@ mod sse_events { start -> work -> exit }"#; - async fn test_db() -> sqlx::SqlitePool { - let pool = fabro_db::connect_memory().await.unwrap(); - fabro_db::initialize_db(&pool).await.unwrap(); - pool - } - #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn sse_stream_contains_expected_event_types() { let state = create_app_state(test_db().await, test_llm_spec); @@ -791,13 +759,13 @@ mod sse_events { // =========================================================================== mod serve_dry_run { + use super::super::helpers::{test_db, test_llm_spec}; use std::sync::Arc; use std::time::Duration; use axum::body::Body; use axum::http::{Request, StatusCode}; use fabro_api::server::{build_router, create_app_state}; - use fabro_workflows::pipeline::LlmSpec; use tower::ServiceExt; const MINIMAL_DOT: &str = r#"digraph Test { @@ -807,22 +775,6 @@ mod serve_dry_run { start -> exit }"#; - async fn test_db() -> sqlx::SqlitePool { - let pool = fabro_db::connect_memory().await.unwrap(); - fabro_db::initialize_db(&pool).await.unwrap(); - pool - } - - fn test_llm_spec() -> LlmSpec { - LlmSpec { - model: "test-model".to_string(), - provider: fabro_llm::Provider::Anthropic, - fallback_chain: Vec::new(), - mcp_servers: Vec::new(), - dry_run: true, - } - } - /// 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, test_llm_spec); diff --git a/lib/crates/fabro-api/tests/it/helpers.rs b/lib/crates/fabro-api/tests/it/helpers.rs new file mode 100644 index 000000000..f586dd540 --- /dev/null +++ b/lib/crates/fabro-api/tests/it/helpers.rs @@ -0,0 +1,17 @@ +use fabro_workflows::pipeline::LlmSpec; + +pub(crate) fn test_llm_spec() -> LlmSpec { + LlmSpec { + model: "test-model".to_string(), + provider: fabro_llm::Provider::Anthropic, + fallback_chain: Vec::new(), + mcp_servers: Vec::new(), + dry_run: true, + } +} + +pub(crate) async fn test_db() -> sqlx::SqlitePool { + let pool = fabro_db::connect_memory().await.unwrap(); + fabro_db::initialize_db(&pool).await.unwrap(); + pool +} diff --git a/lib/crates/fabro-api/tests/it/main.rs b/lib/crates/fabro-api/tests/it/main.rs new file mode 100644 index 000000000..d96c912e1 --- /dev/null +++ b/lib/crates/fabro-api/tests/it/main.rs @@ -0,0 +1,4 @@ +mod api; +mod helpers; +mod openapi_conformance; +mod pagination; diff --git a/lib/crates/fabro-api/tests/openapi_conformance.rs b/lib/crates/fabro-api/tests/it/openapi_conformance.rs similarity index 96% rename from lib/crates/fabro-api/tests/openapi_conformance.rs rename to lib/crates/fabro-api/tests/it/openapi_conformance.rs index 57ba1f382..efaea832d 100644 --- a/lib/crates/fabro-api/tests/openapi_conformance.rs +++ b/lib/crates/fabro-api/tests/it/openapi_conformance.rs @@ -1,5 +1,6 @@ //! Conformance tests: spec ↔ router ↔ Rust struct consistency. +use super::helpers::{test_db, test_llm_spec}; use std::collections::BTreeSet; use axum::body::Body; @@ -11,25 +12,8 @@ use fabro_config::run::*; use fabro_config::sandbox::SandboxSettings; use fabro_hooks::*; use fabro_sandbox::daytona::*; -use fabro_workflows::pipeline::LlmSpec; use tower::ServiceExt; -fn test_llm_spec() -> LlmSpec { - LlmSpec { - model: "test-model".to_string(), - provider: fabro_llm::Provider::Anthropic, - fallback_chain: Vec::new(), - mcp_servers: Vec::new(), - dry_run: true, - } -} - -async fn test_db() -> sqlx::SqlitePool { - let pool = fabro_db::connect_memory().await.unwrap(); - fabro_db::initialize_db(&pool).await.unwrap(); - pool -} - fn load_spec() -> openapiv3::OpenAPI { let spec_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .parent() diff --git a/lib/crates/fabro-api/tests/pagination.rs b/lib/crates/fabro-api/tests/it/pagination.rs similarity index 89% rename from lib/crates/fabro-api/tests/pagination.rs rename to lib/crates/fabro-api/tests/it/pagination.rs index 8006af09f..5625a5ad3 100644 --- a/lib/crates/fabro-api/tests/pagination.rs +++ b/lib/crates/fabro-api/tests/it/pagination.rs @@ -1,28 +1,12 @@ //! Tests that paginated list endpoints return `{ data, meta: { has_more } }`. +use super::helpers::{test_db, test_llm_spec}; use axum::body::Body; use axum::http::{Request, StatusCode}; use fabro_api::jwt_auth::AuthMode; use fabro_api::server::{build_router, create_app_state}; -use fabro_workflows::pipeline::LlmSpec; use tower::ServiceExt; -fn test_llm_spec() -> LlmSpec { - LlmSpec { - model: "test-model".to_string(), - provider: fabro_llm::Provider::Anthropic, - fallback_chain: Vec::new(), - mcp_servers: Vec::new(), - dry_run: true, - } -} - -async fn test_db() -> sqlx::SqlitePool { - let pool = fabro_db::connect_memory().await.unwrap(); - fabro_db::initialize_db(&pool).await.unwrap(); - pool -} - async fn get_json(app: axum::Router, uri: &str) -> serde_json::Value { let req = Request::builder() .method("GET") diff --git a/lib/crates/fabro-cli/tests/cli.rs b/lib/crates/fabro-cli/tests/it/cli.rs similarity index 100% rename from lib/crates/fabro-cli/tests/cli.rs rename to lib/crates/fabro-cli/tests/it/cli.rs diff --git a/lib/crates/fabro-cli/tests/it/main.rs b/lib/crates/fabro-cli/tests/it/main.rs new file mode 100644 index 000000000..5887bfa77 --- /dev/null +++ b/lib/crates/fabro-cli/tests/it/main.rs @@ -0,0 +1,3 @@ +mod cli; +mod scenario; +mod trycmd; diff --git a/lib/crates/fabro-cli/tests/scenario.rs b/lib/crates/fabro-cli/tests/it/scenario.rs similarity index 100% rename from lib/crates/fabro-cli/tests/scenario.rs rename to lib/crates/fabro-cli/tests/it/scenario.rs diff --git a/lib/crates/fabro-cli/tests/trycmd.rs b/lib/crates/fabro-cli/tests/it/trycmd.rs similarity index 100% rename from lib/crates/fabro-cli/tests/trycmd.rs rename to lib/crates/fabro-cli/tests/it/trycmd.rs diff --git a/lib/crates/fabro-cli/tests/snapshots/cli__serve_help.snap b/lib/crates/fabro-cli/tests/snapshots/it__cli__serve_help.snap similarity index 95% rename from lib/crates/fabro-cli/tests/snapshots/cli__serve_help.snap rename to lib/crates/fabro-cli/tests/snapshots/it__cli__serve_help.snap index fcb3f5b30..7e02a992a 100644 --- a/lib/crates/fabro-cli/tests/snapshots/cli__serve_help.snap +++ b/lib/crates/fabro-cli/tests/snapshots/it__cli__serve_help.snap @@ -1,5 +1,5 @@ --- -source: lib/crates/fabro-cli/tests/cli.rs +source: lib/crates/fabro-cli/tests/it/cli.rs assertion_line: 349 expression: stdout --- diff --git a/lib/crates/fabro-devcontainer/tests/e2e.rs b/lib/crates/fabro-devcontainer/tests/it/e2e.rs similarity index 99% rename from lib/crates/fabro-devcontainer/tests/e2e.rs rename to lib/crates/fabro-devcontainer/tests/it/e2e.rs index 64a82f785..5d2cdabda 100644 --- a/lib/crates/fabro-devcontainer/tests/e2e.rs +++ b/lib/crates/fabro-devcontainer/tests/it/e2e.rs @@ -5,14 +5,8 @@ //! 3. containerEnv //! 4. dockerComposeFile array +use super::helpers::fixture_path; use fabro_devcontainer::{Command, DevcontainerResolver}; -use std::path::PathBuf; - -fn fixture_path(name: &str) -> PathBuf { - PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("tests/fixtures") - .join(name) -} /// Realistic Python project: Dockerfile + build.args + containerEnv + onCreateCommand + remoteEnv /// Verifies all 4 gaps work together in a single config. diff --git a/lib/crates/fabro-devcontainer/tests/it/helpers.rs b/lib/crates/fabro-devcontainer/tests/it/helpers.rs new file mode 100644 index 000000000..98f42af26 --- /dev/null +++ b/lib/crates/fabro-devcontainer/tests/it/helpers.rs @@ -0,0 +1,7 @@ +use std::path::PathBuf; + +pub(super) fn fixture_path(name: &str) -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("tests/fixtures") + .join(name) +} diff --git a/lib/crates/fabro-devcontainer/tests/integration.rs b/lib/crates/fabro-devcontainer/tests/it/integration.rs similarity index 97% rename from lib/crates/fabro-devcontainer/tests/integration.rs rename to lib/crates/fabro-devcontainer/tests/it/integration.rs index df7fa7af7..4a9130ed1 100644 --- a/lib/crates/fabro-devcontainer/tests/integration.rs +++ b/lib/crates/fabro-devcontainer/tests/it/integration.rs @@ -1,11 +1,5 @@ +use super::helpers::fixture_path; use fabro_devcontainer::{Command, DevcontainerResolver}; -use std::path::PathBuf; - -fn fixture_path(name: &str) -> PathBuf { - PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("tests/fixtures") - .join(name) -} #[tokio::test] async fn resolve_image_only() { diff --git a/lib/crates/fabro-devcontainer/tests/it/main.rs b/lib/crates/fabro-devcontainer/tests/it/main.rs new file mode 100644 index 000000000..7c72eb25a --- /dev/null +++ b/lib/crates/fabro-devcontainer/tests/it/main.rs @@ -0,0 +1,3 @@ +mod e2e; +mod helpers; +mod integration; diff --git a/lib/crates/fabro-workflows/tests/attractor_compat.rs b/lib/crates/fabro-workflows/tests/it/attractor_compat.rs similarity index 100% rename from lib/crates/fabro-workflows/tests/attractor_compat.rs rename to lib/crates/fabro-workflows/tests/it/attractor_compat.rs diff --git a/lib/crates/fabro-workflows/tests/cp_integration.rs b/lib/crates/fabro-workflows/tests/it/cp_integration.rs similarity index 100% rename from lib/crates/fabro-workflows/tests/cp_integration.rs rename to lib/crates/fabro-workflows/tests/it/cp_integration.rs diff --git a/lib/crates/fabro-workflows/tests/daytona_integration.rs b/lib/crates/fabro-workflows/tests/it/daytona_integration.rs similarity index 100% rename from lib/crates/fabro-workflows/tests/daytona_integration.rs rename to lib/crates/fabro-workflows/tests/it/daytona_integration.rs diff --git a/lib/crates/fabro-workflows/tests/integration.rs b/lib/crates/fabro-workflows/tests/it/integration.rs similarity index 100% rename from lib/crates/fabro-workflows/tests/integration.rs rename to lib/crates/fabro-workflows/tests/it/integration.rs diff --git a/lib/crates/fabro-workflows/tests/it/main.rs b/lib/crates/fabro-workflows/tests/it/main.rs new file mode 100644 index 000000000..f75d33431 --- /dev/null +++ b/lib/crates/fabro-workflows/tests/it/main.rs @@ -0,0 +1,4 @@ +mod attractor_compat; +mod cp_integration; +mod daytona_integration; +mod integration;