惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
有赞技术团队
有赞技术团队
量子位
N
Netflix TechBlog - Medium
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
V2EX
IT之家
IT之家
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
perf(test): use gateway harness for cli connect smoke · o...
steipete · 2026-04-23 · via Recent Commits to openclaw:main

@@ -1,72 +1,17 @@

1-

import fs from "node:fs/promises";

2-

import os from "node:os";

3-

import path from "node:path";

4-

import { afterEach, describe, expect, it } from "vitest";

5-

import { clearConfigCache, clearRuntimeConfigSnapshot } from "../config/config.js";

6-

import { clearSessionStoreCacheForTest } from "../config/sessions/store.js";

7-

import { captureEnv } from "../test-utils/env.js";

8-

import {

9-

connectTestGatewayClient,

10-

ensurePairedTestGatewayClientIdentity,

11-

getFreeGatewayPort,

12-

} from "./gateway-cli-backend.live-helpers.js";

13-

import { startGatewayServer } from "./server.js";

1+

import { describe, expect, it } from "vitest";

2+

import { connectTestGatewayClient } from "./gateway-cli-backend.live-helpers.js";

3+

import { getFreePort, installGatewayTestHooks, startGatewayServer } from "./test-helpers.js";

14415-

const GATEWAY_CONNECT_TIMEOUT_MS = 90_000;

5+

const GATEWAY_CONNECT_TIMEOUT_MS = 10_000;

166177

describe("gateway cli backend connect", () => {

18-

afterEach(() => {

19-

clearRuntimeConfigSnapshot();

20-

clearConfigCache();

21-

clearSessionStoreCacheForTest();

22-

});

8+

installGatewayTestHooks();

2392410

it(

2511

"connects a same-process test gateway client in minimal mode",

2612

async () => {

27-

const envSnapshot = captureEnv([

28-

"HOME",

29-

"OPENCLAW_STATE_DIR",

30-

"OPENCLAW_CONFIG_PATH",

31-

"OPENCLAW_GATEWAY_TOKEN",

32-

"OPENCLAW_SKIP_CHANNELS",

33-

"OPENCLAW_SKIP_PROVIDERS",

34-

"OPENCLAW_SKIP_GMAIL_WATCHER",

35-

"OPENCLAW_SKIP_CRON",

36-

"OPENCLAW_SKIP_CANVAS_HOST",

37-

"OPENCLAW_SKIP_BROWSER_CONTROL_SERVER",

38-

"OPENCLAW_BUNDLED_PLUGINS_DIR",

39-

"OPENCLAW_TEST_MINIMAL_GATEWAY",

40-

]);

41-42-

const tempHome = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-gateway-connect-home-"));

43-

const configPath = path.join(tempHome, ".openclaw", "openclaw.json");

44-

const bundledPluginsDir = path.join(tempHome, "openclaw-test-no-bundled-extensions");

4513

const token = `test-${Date.now()}`;

46-

process.env.HOME = tempHome;

47-

process.env.OPENCLAW_STATE_DIR = path.join(tempHome, ".openclaw");

48-

process.env.OPENCLAW_CONFIG_PATH = configPath;

49-

process.env.OPENCLAW_GATEWAY_TOKEN = token;

50-

process.env.OPENCLAW_SKIP_CHANNELS = "1";

51-

process.env.OPENCLAW_SKIP_PROVIDERS = "1";

52-

process.env.OPENCLAW_SKIP_GMAIL_WATCHER = "1";

53-

process.env.OPENCLAW_SKIP_CRON = "1";

54-

process.env.OPENCLAW_SKIP_CANVAS_HOST = "1";

55-

process.env.OPENCLAW_SKIP_BROWSER_CONTROL_SERVER = "1";

56-

process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = bundledPluginsDir;

57-

process.env.OPENCLAW_TEST_MINIMAL_GATEWAY = "1";

58-

await fs.mkdir(path.dirname(configPath), { recursive: true });

59-

await fs.mkdir(bundledPluginsDir, { recursive: true });

60-

await fs.writeFile(

61-

configPath,

62-

`${JSON.stringify({ gateway: { auth: { mode: "token", token } } }, null, 2)}\n`,

63-

);

64-

clearRuntimeConfigSnapshot();

65-

clearConfigCache();

66-

clearSessionStoreCacheForTest();

67-68-

const deviceIdentity = await ensurePairedTestGatewayClientIdentity();

69-

const port = await getFreeGatewayPort();

14+

const port = await getFreePort();

7015

const server = await startGatewayServer(port, {

7116

bind: "loopback",

7217

auth: { mode: "token", token },

@@ -78,7 +23,9 @@ describe("gateway cli backend connect", () => {

7823

client = await connectTestGatewayClient({

7924

url: `ws://127.0.0.1:${port}`,

8025

token,

81-

deviceIdentity,

26+

timeoutMs: 5_000,

27+

maxAttemptTimeoutMs: 5_000,

28+

requestTimeoutMs: 5_000,

8229

});

8330

const health = await client.request("health", undefined, {

8431

timeoutMs: 5_000,

@@ -89,8 +36,6 @@ describe("gateway cli backend connect", () => {

8936

} finally {

9037

await client?.stopAndWait({ timeoutMs: 1_000 }).catch(() => {});

9138

await server.close({ reason: "gateway connect regression complete" });

92-

await fs.rm(tempHome, { recursive: true, force: true });

93-

envSnapshot.restore();

9439

}

9540

},

9641

GATEWAY_CONNECT_TIMEOUT_MS,