Files
Strata/app/host/tests/timeout-format-verification.test.mjs
T
Niko1221 4058aa782b Layout move for 0.2.16: the top level becomes app/, engine/, terminal/, docs/, tools/ and .github/
Made by tools/layout/move_0216.py (the commit before this one) on db8e0be9c, the final code head of 0.2.16:
- 75 git mv (renames, so `git log --follow` and blame keep working; packaging/acceptance_matrix.md shows as delete + add because its links
  changed too) and 3 removals: SETUP.bat, UPDATE.bat and update.sh (setup.py --update pulls the code now);
- 1,425 path edits in 307 files: root-relative paths in CI, Docker, .gitignore and the release scripts; Markdown links; Python and
  Node joins from a root that moved with its folder; explicit edits for code that computes a root or names a moved path; tables of
  repository paths inside tests.

engine/ holds what CMake builds (src, include, cmake, metal, sycl, spark, third_party, the C++ tests and benches). app/ is the desktop
app and its host (was apps/). terminal/ is the Terminal in the layout of the installed one (strata.py, setup.py, strata_cli,
strata_control, serve, bin, data, ref, crates, the Python tools and tests). docs/ has the documentation, docs/lang/ the translated
READMEs, docs/history and docs/bench-results. tools/ has the repository's own checks, packaging, docker, research and nix.
tests/core/test_tqp_ref.py is a pytest file and stays with the Python tests (terminal/tests/core/).
AGENTS.md, README.md, LICENSE, setup.sh and START-HERE.bat stay at the root.

No behaviour change: the same command lines, the same sources. For this head a replay of the script gave the same numbers and the path
scan (tools/layout/checks/path_scan.py) reports no hit; the suites and the builds run on this commit next.
2026-11-17 13:19:21 +01:00

153 lines
4.4 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { mcpRows } from '../server/agent/profile.mjs';
test('Format 1: server with timeoutSec (e.g. from Strata custom tools settings)', () => {
const env = {};
const servers = {
'my-mcp': {
command: 'node',
args: ['server.js'],
timeoutSec: 300,
},
};
const rows = mcpRows(servers, env);
assert.equal(rows.length, 1);
assert.equal(rows[0].name, '@deepseek-ai/dsh-mcp-client');
assert.equal(rows[0].config.serverName, 'my-mcp');
assert.equal(rows[0].config.toolCallTimeoutMs, 300000);
});
test('Format 2: server with timeout_s (e.g. from strata-<model>.json or mcp_servers.json)', () => {
const env = {};
const servers = {
'relay-mcp': {
command: 'node',
args: ['relay.js'],
timeout_s: 180,
},
};
const rows = mcpRows(servers, env);
assert.equal(rows.length, 1);
assert.equal(rows[0].config.serverName, 'relay-mcp');
assert.equal(rows[0].config.toolCallTimeoutMs, 180000);
});
test('Format 3: server with timeout (e.g. Claude Desktop style)', () => {
const env = {};
const servers = {
'claude-style-mcp': {
command: 'node',
args: ['claude.js'],
timeout: 240,
},
};
const rows = mcpRows(servers, env);
assert.equal(rows.length, 1);
assert.equal(rows[0].config.serverName, 'claude-style-mcp');
assert.equal(rows[0].config.toolCallTimeoutMs, 240000);
});
test('Format 4: server with direct toolCallTimeoutMs in milliseconds', () => {
const env = {};
const servers = {
'direct-ms-mcp': {
command: 'node',
args: ['direct.js'],
toolCallTimeoutMs: 450000,
},
};
const rows = mcpRows(servers, env);
assert.equal(rows.length, 1);
assert.equal(rows[0].config.serverName, 'direct-ms-mcp');
assert.equal(rows[0].config.toolCallTimeoutMs, 450000);
});
test('Format 5: Streamable HTTP server with timeoutSec', () => {
const env = {};
const servers = {
'remote-mcp': {
url: 'https://mcp.example.com/sse',
timeoutSec: 600,
},
};
const rows = mcpRows(servers, env);
assert.equal(rows.length, 1);
assert.equal(rows[0].config.serverName, 'remote-mcp');
assert.equal(rows[0].config.transport, 'streamable-http');
assert.equal(rows[0].config.toolCallTimeoutMs, 600000);
});
test('Format 6: environment variable STRATA_MCP_TIMEOUT_MS fallback', () => {
const originalEnv = process.env.STRATA_MCP_TIMEOUT_MS;
try {
process.env.STRATA_MCP_TIMEOUT_MS = '500000';
const env = {};
const servers = {
'fallback-mcp': {
command: 'node',
args: ['server.js'],
},
};
const rows = mcpRows(servers, env);
assert.equal(rows.length, 1);
assert.equal(rows[0].config.toolCallTimeoutMs, 500000);
} finally {
if (originalEnv === undefined) delete process.env.STRATA_MCP_TIMEOUT_MS;
else process.env.STRATA_MCP_TIMEOUT_MS = originalEnv;
}
});
test('Format 7: explicit server timeout overrides environment variable', () => {
const originalEnv = process.env.STRATA_MCP_TIMEOUT_MS;
try {
process.env.STRATA_MCP_TIMEOUT_MS = '500000';
const env = {};
const servers = {
'override-mcp': {
command: 'node',
args: ['server.js'],
timeoutSec: 120, // 120s should win over 500s env var
},
};
const rows = mcpRows(servers, env);
assert.equal(rows.length, 1);
assert.equal(rows[0].config.toolCallTimeoutMs, 120000);
} finally {
if (originalEnv === undefined) delete process.env.STRATA_MCP_TIMEOUT_MS;
else process.env.STRATA_MCP_TIMEOUT_MS = originalEnv;
}
});
test('Format 8: string numeric values are safely parsed', () => {
const env = {};
const servers = {
'string-timeout': {
command: 'node',
args: ['server.js'],
timeoutSec: '150',
},
};
const rows = mcpRows(servers, env);
assert.equal(rows[0].config.toolCallTimeoutMs, 150000);
});
test('Format 9: omitted timeout preserves undefined (client schema default applies)', () => {
const originalEnv = process.env.STRATA_MCP_TIMEOUT_MS;
delete process.env.STRATA_MCP_TIMEOUT_MS;
try {
const env = {};
const servers = {
'default-mcp': {
command: 'node',
args: ['server.js'],
},
};
const rows = mcpRows(servers, env);
assert.equal(rows.length, 1);
assert.equal(rows[0].config.toolCallTimeoutMs, undefined);
} finally {
if (originalEnv !== undefined) process.env.STRATA_MCP_TIMEOUT_MS = originalEnv;
}
});