mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 06:23:35 +00:00
refactor(proxy): store captures in shared state database
This commit is contained in:
@@ -39,8 +39,7 @@ vi.mock("../infra/net/proxy/proxy-validation.js", () => ({
|
||||
|
||||
describe("proxy cli runtime", () => {
|
||||
const envKeys = [
|
||||
"OPENCLAW_DEBUG_PROXY_DB_PATH",
|
||||
"OPENCLAW_DEBUG_PROXY_BLOB_DIR",
|
||||
"OPENCLAW_STATE_DIR",
|
||||
"OPENCLAW_DEBUG_PROXY_CERT_DIR",
|
||||
"OPENCLAW_DEBUG_PROXY_SESSION_ID",
|
||||
"OPENCLAW_DEBUG_PROXY_ENABLED",
|
||||
@@ -52,8 +51,7 @@ describe("proxy cli runtime", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = mkdtempSync(path.join(os.tmpdir(), "openclaw-proxy-cli-runtime-"));
|
||||
process.env.OPENCLAW_DEBUG_PROXY_DB_PATH = path.join(tempDir, "capture.sqlite");
|
||||
process.env.OPENCLAW_DEBUG_PROXY_BLOB_DIR = path.join(tempDir, "blobs");
|
||||
process.env.OPENCLAW_STATE_DIR = tempDir;
|
||||
process.env.OPENCLAW_DEBUG_PROXY_CERT_DIR = path.join(tempDir, "certs");
|
||||
delete process.env.OPENCLAW_DEBUG_PROXY_ENABLED;
|
||||
delete process.env.OPENCLAW_DEBUG_PROXY_SESSION_ID;
|
||||
@@ -92,7 +90,9 @@ describe("proxy cli runtime", () => {
|
||||
|
||||
afterEach(async () => {
|
||||
const { closeDebugProxyCaptureStore } = await import("../proxy-capture/store.sqlite.js");
|
||||
const { closeOpenClawStateDatabaseForTest } = await import("../state/openclaw-state-db.js");
|
||||
closeDebugProxyCaptureStore();
|
||||
closeOpenClawStateDatabaseForTest();
|
||||
vi.restoreAllMocks();
|
||||
vi.resetModules();
|
||||
process.exitCode = undefined;
|
||||
@@ -503,10 +503,7 @@ describe("proxy cli runtime", () => {
|
||||
|
||||
expect(serverStopSpy).toHaveBeenCalledTimes(1);
|
||||
|
||||
const store = getDebugProxyCaptureStore(
|
||||
process.env.OPENCLAW_DEBUG_PROXY_DB_PATH!,
|
||||
process.env.OPENCLAW_DEBUG_PROXY_BLOB_DIR!,
|
||||
);
|
||||
const store = getDebugProxyCaptureStore();
|
||||
const [session] = store.listSessions(5);
|
||||
expect(session?.mode).toBe("proxy-run");
|
||||
expect(session?.endedAt).toBeGreaterThanOrEqual(beforeRun);
|
||||
|
||||
Reference in New Issue
Block a user