Consolidate integration tests under tests/it

This commit is contained in:
Bryan Helmkamp 2026-03-28 18:39:52 -04:00
parent da08c486c1
commit 48ea1cc4de
No known key found for this signature in database
22 changed files with 48 additions and 100 deletions

View file

@ -0,0 +1,2 @@
mod guardrails;
mod parity_matrix;

View file

@ -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<dyn Interviewer>) -> 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);

View file

@ -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
}

View file

@ -0,0 +1,4 @@
mod api;
mod helpers;
mod openapi_conformance;
mod pagination;

View file

@ -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()

View file

@ -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")

View file

@ -0,0 +1,3 @@
mod cli;
mod scenario;
mod trycmd;

View file

@ -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
---

View file

@ -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.

View file

@ -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)
}

View file

@ -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() {

View file

@ -0,0 +1,3 @@
mod e2e;
mod helpers;
mod integration;

View file

@ -0,0 +1,4 @@
mod attractor_compat;
mod cp_integration;
mod daytona_integration;
mod integration;