mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:50:43 +00:00
test(qa): isolate matrix stale sync replay
This commit is contained in:
@@ -85,6 +85,7 @@ export const MATRIX_QA_MEDIA_ROOM_KEY = "media";
|
||||
export const MATRIX_QA_MEMBERSHIP_ROOM_KEY = "membership";
|
||||
export const MATRIX_QA_RESTART_ROOM_KEY = "restart";
|
||||
export const MATRIX_QA_SECONDARY_ROOM_KEY = "secondary";
|
||||
export const MATRIX_QA_STALE_SYNC_ROOM_KEY = "stale-sync";
|
||||
|
||||
const MATRIX_QA_LIVE_MODEL_TIMEOUT_MS = 120_000;
|
||||
const MATRIX_QA_IMAGE_GENERATION_TIMEOUT_MS = 180_000;
|
||||
@@ -194,6 +195,12 @@ const MATRIX_QA_RESTART_ROOM_TOPOLOGY = buildMatrixQaSingleGroupTopology({
|
||||
requireMention: true,
|
||||
});
|
||||
|
||||
const MATRIX_QA_STALE_SYNC_ROOM_TOPOLOGY = buildMatrixQaSingleGroupTopology({
|
||||
key: MATRIX_QA_STALE_SYNC_ROOM_KEY,
|
||||
name: "Matrix QA Stale Sync Room",
|
||||
requireMention: true,
|
||||
});
|
||||
|
||||
const MATRIX_QA_HOMESERVER_ROOM_TOPOLOGY = buildMatrixQaSingleGroupTopology({
|
||||
key: MATRIX_QA_HOMESERVER_ROOM_KEY,
|
||||
name: "Matrix QA Homeserver Restart Room",
|
||||
@@ -450,7 +457,7 @@ export const MATRIX_QA_SCENARIOS: MatrixQaScenarioDefinition[] = [
|
||||
id: "matrix-stale-sync-replay-dedupe",
|
||||
timeoutMs: 90_000,
|
||||
title: "Matrix stale sync replay is absorbed by inbound dedupe",
|
||||
topology: MATRIX_QA_RESTART_ROOM_TOPOLOGY,
|
||||
topology: MATRIX_QA_STALE_SYNC_ROOM_TOPOLOGY,
|
||||
},
|
||||
{
|
||||
id: "matrix-room-membership-loss",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
MATRIX_QA_HOMESERVER_ROOM_KEY,
|
||||
MATRIX_QA_RESTART_ROOM_KEY,
|
||||
MATRIX_QA_STALE_SYNC_ROOM_KEY,
|
||||
resolveMatrixQaScenarioRoomId,
|
||||
} from "./scenario-catalog.js";
|
||||
import {
|
||||
@@ -344,7 +345,7 @@ export async function runStaleSyncReplayDedupeScenario(context: MatrixQaScenario
|
||||
throw new Error("Matrix stale sync replay dedupe scenario requires a gateway state directory");
|
||||
}
|
||||
const stateDir = context.gatewayStateDir;
|
||||
const roomId = resolveMatrixQaScenarioRoomId(context, MATRIX_QA_RESTART_ROOM_KEY);
|
||||
const roomId = resolveMatrixQaScenarioRoomId(context, MATRIX_QA_STALE_SYNC_ROOM_KEY);
|
||||
const syncStore = await waitForMatrixSyncStoreWithCursor({
|
||||
context,
|
||||
stateDir,
|
||||
|
||||
@@ -995,6 +995,7 @@ describe("matrix live qa scenarios", () => {
|
||||
const stateRoot = await mkdtemp(path.join(os.tmpdir(), "matrix-stale-sync-"));
|
||||
try {
|
||||
const accountDir = path.join(stateRoot, "matrix", "accounts", "sut", "server", "token");
|
||||
const staleSyncRoomId = "!stale-sync:matrix-qa.test";
|
||||
const syncStorePath = path.join(accountDir, "bot-storage.json");
|
||||
const dedupeStorePath = path.join(accountDir, "inbound-dedupe.json");
|
||||
await mkdir(accountDir, { recursive: true });
|
||||
@@ -1025,7 +1026,7 @@ describe("matrix live qa scenarios", () => {
|
||||
version: 1,
|
||||
entries: [
|
||||
{
|
||||
key: "!restart:matrix-qa.test|$first-trigger",
|
||||
key: `${staleSyncRoomId}|$first-trigger`,
|
||||
ts: Date.now(),
|
||||
},
|
||||
],
|
||||
@@ -1034,7 +1035,7 @@ describe("matrix live qa scenarios", () => {
|
||||
return {
|
||||
event: {
|
||||
kind: "message",
|
||||
roomId: "!restart:matrix-qa.test",
|
||||
roomId: staleSyncRoomId,
|
||||
eventId: kind === "fresh" ? "$fresh-reply" : "$first-reply",
|
||||
sender: "@sut:matrix-qa.test",
|
||||
type: "m.room.message",
|
||||
@@ -1086,7 +1087,7 @@ describe("matrix live qa scenarios", () => {
|
||||
defaultRoomKey: "main",
|
||||
rooms: [
|
||||
{
|
||||
key: "restart",
|
||||
key: "stale-sync",
|
||||
kind: "group",
|
||||
memberRoles: ["driver", "observer", "sut"],
|
||||
memberUserIds: [
|
||||
@@ -1094,9 +1095,9 @@ describe("matrix live qa scenarios", () => {
|
||||
"@observer:matrix-qa.test",
|
||||
"@sut:matrix-qa.test",
|
||||
],
|
||||
name: "Restart room",
|
||||
name: "Stale sync room",
|
||||
requireMention: true,
|
||||
roomId: "!restart:matrix-qa.test",
|
||||
roomId: staleSyncRoomId,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user