mirror of
https://gitea.ingwaz.work/Ingwaz/openbrain-mcp.git
synced 2026-03-31 14:49:06 +00:00
Run e2e tests against deployed VPS
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user