mirror of https://github.com/openclaw/openclaw.git
Tests: force-reset session cleanup state between runs
This commit is contained in:
parent
20e4d42db3
commit
c389b05d3c
|
|
@ -2,10 +2,13 @@ import fs from "node:fs/promises";
|
|||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { resetSessionWriteLockStateForTest } from "../agents/session-write-lock.js";
|
||||
import {
|
||||
clearSessionStoreCacheForTest,
|
||||
getSessionStoreLockQueueSizeForTest,
|
||||
withSessionStoreLockForTest,
|
||||
} from "../config/sessions/store.js";
|
||||
import { resetFileLockStateForTest } from "../infra/file-lock.js";
|
||||
import { cleanupSessionStateForTest } from "./session-state-cleanup.js";
|
||||
|
||||
const acquireSessionWriteLockMock = vi.hoisted(() =>
|
||||
|
|
@ -32,11 +35,16 @@ function createDeferred<T>() {
|
|||
|
||||
describe("cleanupSessionStateForTest", () => {
|
||||
beforeEach(() => {
|
||||
clearSessionStoreCacheForTest();
|
||||
resetFileLockStateForTest();
|
||||
resetSessionWriteLockStateForTest();
|
||||
acquireSessionWriteLockMock.mockClear();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await cleanupSessionStateForTest();
|
||||
afterEach(() => {
|
||||
clearSessionStoreCacheForTest();
|
||||
resetFileLockStateForTest();
|
||||
resetSessionWriteLockStateForTest();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue