mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-03 18:04:06 +00:00
test: close sqlite state handles in gateway suites
This commit is contained in:
@@ -35,6 +35,7 @@ import {
|
||||
} from "../routing/session-key.js";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
|
||||
import { normalizeOptionalString } from "../shared/string-coerce.js";
|
||||
import { closeOpenClawAgentDatabasesForTest } from "../state/openclaw-agent-db.js";
|
||||
import { closeOpenClawStateDatabaseForTest } from "../state/openclaw-state-db.js";
|
||||
import { resetTaskRegistryForTests } from "../tasks/runtime-internal.js";
|
||||
import { resetTaskFlowRegistryForTests } from "../tasks/task-flow-runtime-internal.js";
|
||||
@@ -241,6 +242,7 @@ async function resetGatewayTestState(options: { uniqueConfigRoot: boolean }) {
|
||||
delete process.env.OPENCLAW_GATEWAY_TOKEN;
|
||||
resetTaskRegistryForTests({ persist: false });
|
||||
resetTaskFlowRegistryForTests({ persist: false });
|
||||
closeOpenClawAgentDatabasesForTest();
|
||||
closeOpenClawStateDatabaseForTest();
|
||||
const stateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
if (stateDir) {
|
||||
@@ -352,6 +354,8 @@ async function cleanupGatewayTestHome(options: { restoreEnv: boolean }) {
|
||||
resetLogger();
|
||||
resetTaskRegistryForTests({ persist: false });
|
||||
resetTaskFlowRegistryForTests({ persist: false });
|
||||
closeOpenClawAgentDatabasesForTest();
|
||||
closeOpenClawStateDatabaseForTest();
|
||||
if (options.restoreEnv) {
|
||||
gatewayEnvSnapshot?.restore();
|
||||
gatewayEnvSnapshot = undefined;
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { OpenClawConfig } from "../src/config/config.js";
|
||||
import type { OutboundSendDeps } from "../src/infra/outbound/deliver.js";
|
||||
import type { PluginRegistry } from "../src/plugins/registry.js";
|
||||
import { closeOpenClawAgentDatabasesForTest } from "../src/state/openclaw-agent-db.js";
|
||||
import { closeOpenClawStateDatabaseForTest } from "../src/state/openclaw-state-db.js";
|
||||
import { installSharedTestSetup } from "./setup.shared.js";
|
||||
|
||||
installSharedTestSetup();
|
||||
@@ -363,6 +364,7 @@ afterEach(async () => {
|
||||
const { resetContextWindowCacheForTest, resetModelCatalogReadyCacheForTest } =
|
||||
await loadWorkerCleanupHelpers();
|
||||
closeOpenClawAgentDatabasesForTest();
|
||||
closeOpenClawStateDatabaseForTest();
|
||||
resetContextWindowCacheForTest();
|
||||
resetModelCatalogReadyCacheForTest();
|
||||
await installDefaultPluginRegistry();
|
||||
@@ -370,4 +372,5 @@ afterEach(async () => {
|
||||
|
||||
afterAll(async () => {
|
||||
closeOpenClawAgentDatabasesForTest();
|
||||
closeOpenClawStateDatabaseForTest();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user