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:
@@ -214,6 +214,19 @@ jobs:
|
|||||||
curl -fsS "http://$VPS_HOST:3100/health"
|
curl -fsS "http://$VPS_HOST:3100/health"
|
||||||
curl -fsS "http://$VPS_HOST:3100/ready"
|
curl -fsS "http://$VPS_HOST:3100/ready"
|
||||||
|
|
||||||
|
- name: Run VPS e2e tests
|
||||||
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
||||||
|
env:
|
||||||
|
OPENBRAIN_E2E_REMOTE: "true"
|
||||||
|
OPENBRAIN_E2E_BASE_URL: http://${{ secrets.VPS_HOST }}:3100
|
||||||
|
OPENBRAIN_E2E_API_KEY: ${{ secrets.OPENBRAIN_E2E_API_KEY }}
|
||||||
|
OPENBRAIN__AUTH__ENABLED: "true"
|
||||||
|
run: |
|
||||||
|
set -euxo pipefail
|
||||||
|
: "${OPENBRAIN_E2E_API_KEY:?Set repository secret OPENBRAIN_E2E_API_KEY}"
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
|
cargo test --test e2e_mcp -- --test-threads=1
|
||||||
|
|
||||||
- name: Cleanup SSH key
|
- name: Cleanup SSH key
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -71,6 +71,24 @@ Run pending migrations explicitly before starting or restarting the service:
|
|||||||
|
|
||||||
If you use the deploy script or CI workflow in [`.gitea/deploy.sh`](/Users/bobbytables/ai/openbrain-mcp/.gitea/deploy.sh) and [`.gitea/workflows/ci-cd.yaml`](/Users/bobbytables/ai/openbrain-mcp/.gitea/workflows/ci-cd.yaml), they already run this for you.
|
If you use the deploy script or CI workflow in [`.gitea/deploy.sh`](/Users/bobbytables/ai/openbrain-mcp/.gitea/deploy.sh) and [`.gitea/workflows/ci-cd.yaml`](/Users/bobbytables/ai/openbrain-mcp/.gitea/workflows/ci-cd.yaml), they already run this for you.
|
||||||
|
|
||||||
|
### E2E Test Modes
|
||||||
|
|
||||||
|
The end-to-end test suite supports two modes:
|
||||||
|
|
||||||
|
- Local mode: default. Assumes the test process can manage schema setup against a local PostgreSQL instance and, for one auth-only test, spawn a local `openbrain-mcp` child process.
|
||||||
|
- Remote mode: set `OPENBRAIN_E2E_REMOTE=true` and point `OPENBRAIN_E2E_BASE_URL` at a deployed server such as `http://76.13.116.52:3100` or `https://ob.ingwaz.work`. In this mode the suite does not try to create schema locally and skips the local process auth smoke test.
|
||||||
|
|
||||||
|
Recommended env for VPS-backed runs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
OPENBRAIN_E2E_REMOTE=true
|
||||||
|
OPENBRAIN_E2E_BASE_URL=https://ob.ingwaz.work
|
||||||
|
OPENBRAIN_E2E_API_KEY=your_live_api_key
|
||||||
|
OPENBRAIN__AUTH__ENABLED=true
|
||||||
|
```
|
||||||
|
|
||||||
|
The CI workflow uses this remote mode after `main` deploys so e2e coverage validates the VPS deployment rather than the local runner host.
|
||||||
|
|
||||||
## Agent Zero Developer Prompt
|
## Agent Zero Developer Prompt
|
||||||
|
|
||||||
For Agent Zero / A0, add the following section to the Developer agent role
|
For Agent Zero / A0, add the following section to the Developer agent role
|
||||||
|
|||||||
@@ -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())
|
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> {
|
fn api_key() -> Option<String> {
|
||||||
std::env::var("OPENBRAIN_E2E_API_KEY").ok()
|
std::env::var("OPENBRAIN_E2E_API_KEY").ok()
|
||||||
.or_else(|| std::env::var("OPENBRAIN__AUTH__API_KEYS").ok())
|
.or_else(|| std::env::var("OPENBRAIN__AUTH__API_KEYS").ok())
|
||||||
@@ -27,6 +33,10 @@ fn db_url() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn ensure_schema() {
|
async fn ensure_schema() {
|
||||||
|
if remote_mode() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let (client, connection) = tokio_postgres::connect(&db_url(), NoTls)
|
let (client, connection) = tokio_postgres::connect(&db_url(), NoTls)
|
||||||
.await
|
.await
|
||||||
.expect("connect to postgres for e2e schema setup");
|
.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]
|
#[tokio::test]
|
||||||
async fn e2e_auth_enabled_accepts_test_key() {
|
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;
|
ensure_schema().await;
|
||||||
|
|
||||||
let port = pick_free_port();
|
let port = pick_free_port();
|
||||||
|
|||||||
Reference in New Issue
Block a user