chore: retire openhub and pi ts runtime
This commit is contained in:
@@ -4,16 +4,13 @@ const net = require("node:net");
|
||||
const { test } = require("node:test");
|
||||
const {
|
||||
buildDefaultOpencodeCommand,
|
||||
buildDefaultOpenHubCommand,
|
||||
collectStaleMnoteWebCargoPids,
|
||||
resolveBackendExecutable,
|
||||
ensurePortFree,
|
||||
isHttpHealthy,
|
||||
isPortFree,
|
||||
resolveOpenHubHealthPlan,
|
||||
resolveRuntimePlan,
|
||||
shouldStartBackend,
|
||||
shouldStartOpenHub,
|
||||
stopStaleMnoteWebCargoProcesses,
|
||||
} = require("./desktop-hot.js");
|
||||
|
||||
@@ -145,8 +142,6 @@ test("默认热启动计划只使用 mnote-web 作为 3000 owner", () => {
|
||||
MNOTE_WEB_PUBLIC_BIND: "127.0.0.1:3000",
|
||||
MNOTE_KNOWLEDGE_PROVIDER: "lightrag_legacy",
|
||||
MNOTE_OPENCODE_BASE_URL: "http://127.0.0.1:4096",
|
||||
MNOTE_OPENHUB_BASE_URL: "http://127.0.0.1:18080",
|
||||
MNOTE_OPENHUB_DISABLE_GIT_SNAPSHOT_RESTORE: "1",
|
||||
MNOTE_CONTROL_PLANE_BACKEND: "libsql-local",
|
||||
MNOTE_TURSO_LOCAL_PATH: "/mnt/Data1T/Mnote_data/control-plane/control-plane-libsql.db",
|
||||
});
|
||||
@@ -193,50 +188,10 @@ test("默认跳过 FastAPI 后端,只有显式开启时才启动", () => {
|
||||
assert.equal(shouldStartBackend({ ENABLE_BACKEND: "1", SKIP_BACKEND: "1" }), false);
|
||||
});
|
||||
|
||||
test("OpenHub FastAPI 默认跳过,显式开启或命令覆盖时才启动", () => {
|
||||
assert.equal(shouldStartOpenHub({}), false);
|
||||
assert.equal(shouldStartOpenHub({ ENABLE_OPENHUB: "1" }), true);
|
||||
assert.equal(shouldStartOpenHub({ ENABLE_OPENHUB: "true" }), true);
|
||||
assert.equal(shouldStartOpenHub({ OPENHUB_CMD: "custom-openhub" }), true);
|
||||
assert.equal(shouldStartOpenHub({ ENABLE_OPENHUB: "1", SKIP_OPENHUB: "1" }), false);
|
||||
});
|
||||
|
||||
test("OpenHub health plan 包含 FastAPI、Redis、opencode 和默认关闭 Git snapshot/restore", () => {
|
||||
const plan = resolveOpenHubHealthPlan({
|
||||
ENABLE_OPENHUB: "1",
|
||||
REQUIRE_OPENHUB_HEALTH: "1",
|
||||
OPENHUB_PORT: "18081",
|
||||
OPENCODE_PORT: "4097",
|
||||
OPENHUB_REDIS_HEALTH_URL: "http://127.0.0.1:6379/health",
|
||||
});
|
||||
|
||||
assert.equal(plan.enabled, true);
|
||||
assert.equal(plan.openhub.url, "http://127.0.0.1:18081/api/health");
|
||||
assert.equal(plan.openhub.required, true);
|
||||
assert.equal(plan.redis.url, "http://127.0.0.1:6379/health");
|
||||
assert.equal(plan.redis.skipped, false);
|
||||
assert.equal(plan.opencode.url, "http://127.0.0.1:4097/global/health");
|
||||
assert.deepEqual(plan.gitSnapshotRestore, {
|
||||
env: "MNOTE_OPENHUB_DISABLE_GIT_SNAPSHOT_RESTORE",
|
||||
value: "1",
|
||||
defaultDisabled: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("OpenHub 默认命令只启动 FastAPI,不包含 snapshot/restore 写操作", () => {
|
||||
const command = buildDefaultOpenHubCommand(18082);
|
||||
assert.match(command, /app\.main:app/);
|
||||
assert.match(command, /--host "?0\.0\.0\.0"?/);
|
||||
assert.match(command, /--port 18082/);
|
||||
assert.match(command, /\/mnt\/Data1T\/Mnote_data\/openhub\/OpenHub\/smart-query-backend/);
|
||||
assert.match(command, /MNOTE_OPENHUB_DISABLE_GIT_SNAPSHOT_RESTORE="1"/);
|
||||
assert.doesNotMatch(command, /git\s+(snapshot|restore|revert)|kill-port/i);
|
||||
});
|
||||
|
||||
test("opencode 默认命令使用 OpenHub 专用运行目录", () => {
|
||||
test("opencode 默认命令使用 MNote 专用运行目录", () => {
|
||||
const command = buildDefaultOpencodeCommand(18085);
|
||||
assert.match(command, /\/mnt\/Data1T\/Mnote_data\/openhub\/opencode-runtime/);
|
||||
assert.match(command, /\/mnt\/Data1T\/Mnote_data\/openhub\/opencode-home/);
|
||||
assert.match(command, /\/mnt\/Data1T\/Mnote_data\/opencode\/runtime/);
|
||||
assert.match(command, /\/mnt\/Data1T\/Mnote_data\/opencode\/home/);
|
||||
assert.match(command, /HOME=/);
|
||||
assert.match(command, /XDG_CONFIG_HOME=/);
|
||||
assert.doesNotMatch(command, /已检测到现有 opencode/);
|
||||
|
||||
Reference in New Issue
Block a user