Skip to content

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

test: cover TinyMCP artifact wiring in rust test runners

Steven Enamakeled583f9215fe
diff --git a/scripts/__tests__/test-module-installation.test.mjs b/scripts/__tests__/test-module-installation.test.mjs
index f7c40b2c95..b845242b62 100644
--- a/scripts/__tests__/test-module-installation.test.mjs
+++ b/scripts/__tests__/test-module-installation.test.mjs
@@ -214,3 +214,85 @@ for (const [runner, archiveVariable, directoryVariable] of [
}
});
}
+
+
+for (const runner of ["test-rust-with-mock.sh", "test-rust-e2e.sh"]) {
+ test(`${runner} supplies the TinyMCP artifact and executes ignored registry cases`, () => {
+ const source = readFileSync(new URL(`../${runner}`, import.meta.url), "utf8");
+ const setupStart = source.indexOf('tinymcp_asset="');
+ assert.ok(setupStart >= 0, "runner prepares the pinned TinyMCP fixture");
+ const setupEnd = source.indexOf("\n\n", setupStart);
+ const setup = source.slice(setupStart, setupEnd);
+ const root = mkdtempSync(join(tmpdir(), "mcp-runner-"));
+ try {
+ const moduleDir = join(root, "target/test-modules/tinymcp/test-digest");
+ mkdirSync(moduleDir, { recursive: true });
+ writeFileSync(join(moduleDir, "libtinymcp_module.so"), "fixture");
+ // Evaluate the real runner branches with only external commands stubbed.
+ // A cached fixture avoids downloads while exercising the path export.
+ const cargoStub = `cargo_test() {
+ if [[ " $* " == *" --test mcp_registry_e2e "* ]]; then
+ printf 'ARTIFACT=%s\\n' "\${OPENHUMAN_TINYMCP_TEST_MODULE:-missing}"
+ printf 'ARG=%s\\n' "$@"
+ fi
+ }`;
+ let invocation;
+ if (runner === "test-rust-with-mock.sh") {
+ const start = source.indexOf("run_full_suite() {");
+ const end = source.indexOf("\n}\n", start);
+ const directStart = source.indexOf('elif [ "$#" -ge 2 ] && [ "$1" = "--test" ] && [ "$2" = "mcp_registry_e2e" ]');
+ const directEnd = source.indexOf("\nelse\n", directStart);
+ invocation = [
+ "integration_test_targets() { echo mcp_registry_e2e; }",
+ "run_build_only_reaper_test() { :; }",
+ source.slice(start, end + 3),
+ "run_full_suite",
+ "set -- --test mcp_registry_e2e -- --nocapture",
+ "if false; then :",
+ source.slice(directStart, directEnd),
+ "fi",
+ ].join("\n");
+ } else {
+ const start = source.indexOf(' if [ "$suite" = "mcp_registry_e2e" ]');
+ const end = source.indexOf(' if [ "$HAS_EXTRA_ARGS"', start);
+ invocation = [
+ 'suite=mcp_registry_e2e',
+ 'CARGO_BIN=cargo_test',
+ 'EXTRA_ARGS=(--nocapture)',
+ 'bash() { shift; "$@"; }',
+ "for once in 1; do",
+ source.slice(start, end),
+ "done",
+ ].join("\n");
+ }
+ const result = spawnSync("bash", ["-c", [
+ "set -euo pipefail",
+ 'REPO_ROOT="$TEST_ROOT"',
+ 'SCRIPT_DIR="$TEST_ROOT"',
+ 'wallet_platform=ubuntu-22.04-x86_64',
+ 'module_platform=ubuntu-22.04-x86_64',
+ 'module_ext=so',
+ 'PRODUCT_FEATURES=mcp',
+ 'connectors_module=unused',
+ "node() { printf 'tinymcp\\tunused\\tmodule.tar.gz\\ttest-digest\\n'; }",
+ setup,
+ cargoStub,
+ invocation,
+ ].join("\n")], {
+ encoding: "utf8",
+ env: { ...process.env, TEST_ROOT: root, OPENHUMAN_TINYMCP_TEST_MODULE: "" },
+ });
+ assert.equal(result.status, 0, result.stdout + result.stderr);
+ const runs = result.stdout.split("ARTIFACT=").slice(1);
+ assert.equal(runs.length, runner === "test-rust-with-mock.sh" ? 2 : 1);
+ for (const run of runs) {
+ assert.equal(run.split("\n")[0], join(moduleDir, "libtinymcp_module.so"));
+ assert.match(run, /^ARG=--ignored$/m, "ignored cases must actually execute");
+ assert.match(run, /^ARG=--test-threads=1$/m);
+ }
+ assert.match(runs.at(-1), /^ARG=--nocapture$/m, "caller arguments survive");
+ } finally {
+ rmSync(root, { recursive: true, force: true });
+ }
+ });
+}