Run e2e tests against deployed VPS

This commit is contained in:
Agent Zero
2026-03-22 22:52:30 +00:00
parent 8a581b2a2f
commit cb6ccd5394
3 changed files with 46 additions and 0 deletions

View File

@@ -8,6 +8,12 @@ fn base_url() -> String {
std::env::var("OPENBRAIN_E2E_BASE_URL").unwrap_or_else(|_| "http://127.0.0.1:3100".to_string())
}
fn remote_mode() -> bool {
std::env::var("OPENBRAIN_E2E_REMOTE")
.map(|v| v == "true" || v == "1")
.unwrap_or(false)
}
fn api_key() -> Option<String> {
std::env::var("OPENBRAIN_E2E_API_KEY").ok()
.or_else(|| std::env::var("OPENBRAIN__AUTH__API_KEYS").ok())
@@ -27,6 +33,10 @@ fn db_url() -> String {
}
async fn ensure_schema() {
if remote_mode() {
return;
}
let (client, connection) = tokio_postgres::connect(&db_url(), NoTls)
.await
.expect("connect to postgres for e2e schema setup");
@@ -891,6 +901,11 @@ async fn wait_for_status(url: &str, expected_status: reqwest::StatusCode) {
#[tokio::test]
async fn e2e_auth_enabled_accepts_test_key() {
if remote_mode() {
println!("Skipping local auth spawn test in OPENBRAIN_E2E_REMOTE mode");
return;
}
ensure_schema().await;
let port = pick_free_port();