mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
Consolidate integration tests under tests/it
This commit is contained in:
parent
da08c486c1
commit
48ea1cc4de
22 changed files with 48 additions and 100 deletions
2
lib/crates/fabro-agent/tests/it/main.rs
Normal file
2
lib/crates/fabro-agent/tests/it/main.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
mod guardrails;
|
||||
mod parity_matrix;
|
||||
|
|
@ -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);
|
||||
17
lib/crates/fabro-api/tests/it/helpers.rs
Normal file
17
lib/crates/fabro-api/tests/it/helpers.rs
Normal 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
|
||||
}
|
||||
4
lib/crates/fabro-api/tests/it/main.rs
Normal file
4
lib/crates/fabro-api/tests/it/main.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
mod api;
|
||||
mod helpers;
|
||||
mod openapi_conformance;
|
||||
mod pagination;
|
||||
|
|
@ -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()
|
||||
|
|
@ -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")
|
||||
3
lib/crates/fabro-cli/tests/it/main.rs
Normal file
3
lib/crates/fabro-cli/tests/it/main.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
mod cli;
|
||||
mod scenario;
|
||||
mod trycmd;
|
||||
|
|
@ -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
|
||||
---
|
||||
|
|
@ -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.
|
||||
7
lib/crates/fabro-devcontainer/tests/it/helpers.rs
Normal file
7
lib/crates/fabro-devcontainer/tests/it/helpers.rs
Normal 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)
|
||||
}
|
||||
|
|
@ -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() {
|
||||
3
lib/crates/fabro-devcontainer/tests/it/main.rs
Normal file
3
lib/crates/fabro-devcontainer/tests/it/main.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
mod e2e;
|
||||
mod helpers;
|
||||
mod integration;
|
||||
4
lib/crates/fabro-workflows/tests/it/main.rs
Normal file
4
lib/crates/fabro-workflows/tests/it/main.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
mod attractor_compat;
|
||||
mod cp_integration;
|
||||
mod daytona_integration;
|
||||
mod integration;
|
||||
Loading…
Add table
Reference in a new issue