Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(ci): add per-module process isolation for in_process_all test target

Steven Enamakel78295a1eb055
diff --git a/.github/workflows/test-reusable.yml b/.github/workflows/test-reusable.yml
index 24637e0460..b1b92739cb 100644
--- a/.github/workflows/test-reusable.yml
+++ b/.github/workflows/test-reusable.yml
@@ -213,6 +213,12 @@ jobs:
sort
}
+ in_process_modules() {
+ find tests/in_process -maxdepth 1 -type f -name '*.rs' -print |
+ sed -e 's#^tests/in_process/##' -e 's#\.rs$##' |
+ sort
+ }
+
# This lane tests THE PRODUCT, so it must select the product's gates.
# `[features] default` is the CONTRIBUTOR set now and omits voice,
# web3, documents, meet, contacts, inference and crash-reporting.
@@ -250,6 +256,15 @@ jobs:
echo "[test-reusable] raw coverage module: ${module}"
bash scripts/ci-cancel-aware.sh cargo test -p openhuman-cli --features "${CLI_FEATURES}" --test "${target}" -- "${module}::" --test-threads=1
done < <(raw_coverage_modules)
+ elif [ "${target}" = "in_process_all" ]; then
+ # ~20 former tests/*.rs targets share one binary now. Keep one
+ # process per module, as before, so the process-global RPC
+ # bearer, backend transport and module singletons stay per suite.
+ while IFS= read -r module; do
+ [ -n "${module}" ] || continue
+ echo "[test-reusable] in-process module: ${module}"
+ bash scripts/ci-cancel-aware.sh cargo test -p openhuman-cli --features "${CLI_FEATURES}" --test "${target}" -- "${module}::"
+ done < <(in_process_modules)
elif [ "${target}" = "json_rpc_e2e" ]; then
# JSON-RPC E2E cases change process-global provider routes and
# environment. A single parallel libtest process lets one case
diff --git a/scripts/ci/rust-coverage.sh b/scripts/ci/rust-coverage.sh
index 9ad2a571d2..c7399fe25c 100755
--- a/scripts/ci/rust-coverage.sh
+++ b/scripts/ci/rust-coverage.sh
@@ -48,6 +48,12 @@ raw_coverage_modules() {
sort
}
+in_process_modules() {
+ find tests/in_process -maxdepth 1 -type f -name '*.rs' -print |
+ sed -e 's#^tests/in_process/##' -e 's#\.rs$##' |
+ sort
+}
+
# Print each explicitly declared integration-test target and its required
# features as "<name><TAB><comma-separated gates>".
test_target_required_features() {
@@ -119,6 +125,15 @@ run_integration_target() {
suite "${target}::${module}" llvm_cov --no-report --no-fail-fast -p openhuman-cli \
--test "${target}" -- "${module}::" --test-threads=1
done < <(raw_coverage_modules)
+ elif [ "${target}" = "in_process_all" ]; then
+ # The former in-process router targets share one binary; keep one process
+ # per module so their process globals stay per suite, as before.
+ while IFS= read -r module; do
+ [ -n "${module}" ] || continue
+ log "running in-process module: ${module}"
+ suite "${target}::${module}" llvm_cov --no-report --no-fail-fast -p openhuman-cli \
+ --test "${target}" -- "${module}::"
+ done < <(in_process_modules)
elif [ "${target}" = "json_rpc_e2e" ]; then
# JSON-RPC tests share runtime/config globals and must remain serial.
suite "${target}" llvm_cov --no-report --no-fail-fast -p openhuman-cli \
diff --git a/scripts/test-rust-e2e.sh b/scripts/test-rust-e2e.sh
index b37c139ea4..38b8eedad2 100755
--- a/scripts/test-rust-e2e.sh
+++ b/scripts/test-rust-e2e.sh
@@ -30,7 +30,9 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# serially so CI does not link several large integration binaries at once.
# Tests guarded by `#[ignore]` stay skipped unless the caller passes
# `-- --ignored`.
-# The suite list is DERIVED from `tests/*_e2e.rs`, not hand-maintained.
+# The suite list is DERIVED from `tests/*_e2e.rs` plus the `in_process_all`
+# aggregate (the former in-process router suites now live under
+# `tests/in_process/`), not hand-maintained.
#
# It used to be a literal list of 20 names while 29 `tests/*_e2e.rs` targets
# existed, so nine were silently absent from this runner — including
@@ -58,7 +60,7 @@ _discover_e2e_suites() {
done
[ $skip -eq 0 ] && printf '%s\n' "$name"
done < <(
- find "$REPO_ROOT/tests" -maxdepth 1 -type f -name '*_e2e.rs' -print |
+ find "$REPO_ROOT/tests" -maxdepth 1 -type f \( -name '*_e2e.rs' -o -name 'in_process_all.rs' \) -print |
sed -e 's#.*/##' -e 's#\.rs$##' |
sort
)
@@ -225,11 +227,33 @@ run_json_rpc_e2e_suite() {
done <<<"$test_names"
}
+run_in_process_modules() {
+ # `in_process_all` folds ~20 former `tests/*.rs` targets into one binary. Run
+ # each module in its own process, as those targets did, so process globals
+ # (the transport install, the RPC bearer, module singletons) stay per suite.
+ local module
+ while IFS= read -r module; do
+ [ -n "$module" ] || continue
+ echo "[rust-e2e] in_process module: ${module}"
+ bash "$SCRIPT_DIR/ci-cancel-aware.sh" "$CARGO_BIN" test \
+ --manifest-path Cargo.toml --features "$PRODUCT_FEATURES" \
+ --test in_process_all -- "${module}::" ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"}
+ done < <(
+ find "$REPO_ROOT/tests/in_process" -maxdepth 1 -type f -name '*.rs' -print |
+ sed -e 's#.*/##' -e 's#\.rs$##' |
+ sort
+ )
+}
+
for suite in "${SUITES[@]}"; do
if [ "$suite" = "json_rpc_e2e" ]; then
run_json_rpc_e2e_suite
continue
fi
+ if [ "$suite" = "in_process_all" ]; then
+ run_in_process_modules
+ continue
+ fi
if [ "${#EXTRA_ARGS[@]}" -gt 0 ]; then
echo "[rust-e2e] $CARGO_BIN test --manifest-path Cargo.toml --test $suite -- ${EXTRA_ARGS[*]}"
diff --git a/scripts/test-rust-with-mock.sh b/scripts/test-rust-with-mock.sh
index 04938b1ba2..c604cb5818 100755
--- a/scripts/test-rust-with-mock.sh
+++ b/scripts/test-rust-with-mock.sh
@@ -215,6 +215,24 @@ run_raw_coverage_modules() {
done < <(raw_coverage_modules)
}
+in_process_modules() {
+ find tests/in_process -maxdepth 1 -type f -name '*.rs' -print |
+ sed -e 's#^tests/in_process/##' -e 's#\.rs$##' |
+ sort
+}
+
+run_in_process_modules() {
+ # ~20 former `tests/*.rs` targets now share the `in_process_all` binary. Run
+ # each module in its own cargo process so the process-global RPC bearer,
+ # backend transport and module singletons stay per suite, as they were.
+ while IFS= read -r module; do
+ [ -n "$module" ] || continue
+ echo "[test-rust-with-mock] in-process module: ${module}"
+ TINYCONNECTORS_TEST_MODULE="${TINYCONNECTORS_TEST_MODULE:-$connectors_module}" \
+ cargo_test --test in_process_all -- "${module}::" "$@"
+ done < <(in_process_modules)
+}
+
run_json_rpc_e2e() {
# The JSON-RPC E2E binary intentionally changes process-global environment
# and runtime configuration. Run each case in a fresh test process so a
@@ -255,6 +273,8 @@ run_full_suite() {
# each generated module filter in its own cargo process so local
# `pnpm test:rust` preserves the same process-global isolation as CI.
run_raw_coverage_modules "$@"
+ elif [ "$target" = "in_process_all" ]; then
+ run_in_process_modules "$@"
elif [ "$target" = "json_rpc_e2e" ]; then
run_json_rpc_e2e "$@"
else
@@ -275,6 +295,12 @@ elif [ "$#" -ge 2 ] && [ "$1" = "--test" ] && [ "$2" = "raw_coverage_all" ]; the
shift
fi
run_raw_coverage_modules "$@"
+elif [ "$#" -ge 2 ] && [ "$1" = "--test" ] && [ "$2" = "in_process_all" ]; then
+ shift 2
+ if [ "${1:-}" = "--" ]; then
+ shift
+ fi
+ run_in_process_modules "$@"
elif [ "$#" -ge 2 ] && [ "$1" = "--test" ] && [ "$2" = "json_rpc_e2e" ]; then
shift 2
if [ "${1:-}" = "--" ]; then