test(memory): isolate qmd timer state in prerelease shard

This commit is contained in:
Peter Steinberger
2026-06-01 06:03:24 +01:00
parent 711ab45025
commit 4e57546a87
4 changed files with 14 additions and 2 deletions

View File

@@ -400,7 +400,8 @@ describe("memory-core dreaming phases", () => {
).resolves.toBeUndefined();
const dreams = await fs.readFile(path.join(workspaceDir, "DREAMS.md"), "utf-8");
expect(dreams).toContain("Move backups to S3 Glacier.");
expect(dreams).toContain("A memory trace surfaced, but details were unavailable in this run.");
expect(dreams).not.toContain("Move backups to S3 Glacier.");
expect(logger.error).not.toHaveBeenCalled();
expectIncludesSubstring(mockStringMessages(logger.info), "request-scoped");
expectNotIncludesSubstring(mockStringMessages(logger.warn), "request-scoped");

View File

@@ -1,5 +1,5 @@
import { MAX_TIMER_TIMEOUT_MS } from "openclaw/plugin-sdk/number-runtime";
import { describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import {
resolveEmbeddingTimeoutMs,
resolveMemoryIndexConcurrency,
@@ -96,6 +96,11 @@ describe("local embedding worker failure detection", () => {
});
describe("memory embedding timeout abort", () => {
beforeEach(() => {
vi.useRealTimers();
vi.restoreAllMocks();
});
it("aborts the provider operation when the timeout fires", async () => {
let signalSeen: AbortSignal | undefined;

View File

@@ -300,6 +300,11 @@ describe("QmdMemoryManager", () => {
});
beforeEach(async () => {
vi.useRealTimers();
vi.restoreAllMocks();
delete (globalThis as Record<PropertyKey, unknown>)[MCPORTER_STATE_KEY];
delete (globalThis as Record<PropertyKey, unknown>)[QMD_EMBED_QUEUE_KEY];
delete (globalThis as Record<PropertyKey, unknown>)[MEMORY_EMBEDDING_PROVIDERS_KEY];
spawnMock.mockClear();
spawnMock.mockImplementation(() => createMockChild());
watchMock.mockClear();

View File

@@ -17,6 +17,7 @@ export function createExtensionMemoryVitestConfig(
{
dir: "extensions",
env,
isolate: true,
name: "extension-memory",
passWithNoTests: true,
setupFiles: ["test/setup.extensions.ts"],