mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 07:04:32 +00:00
test(guardrails): exclude suite files and harden auth temp identity naming
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { randomUUID } from "node:crypto";
|
||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { expect } from "vitest";
|
import { expect } from "vitest";
|
||||||
@@ -288,7 +289,7 @@ async function startRateLimitedTokenServerWithPairedDeviceToken() {
|
|||||||
const { server, ws, port, prevToken } = await startServerWithClient();
|
const { server, ws, port, prevToken } = await startServerWithClient();
|
||||||
const deviceIdentityPath = path.join(
|
const deviceIdentityPath = path.join(
|
||||||
os.tmpdir(),
|
os.tmpdir(),
|
||||||
`openclaw-auth-rate-limit-${Date.now()}-${Math.random().toString(36).slice(2)}.json`,
|
"openclaw-auth-rate-limit-" + randomUUID() + ".json",
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
const initial = await connectReq(ws, { token: "secret", deviceIdentityPath });
|
const initial = await connectReq(ws, { token: "secret", deviceIdentityPath });
|
||||||
@@ -322,7 +323,7 @@ async function ensurePairedDeviceTokenForCurrentIdentity(ws: WebSocket): Promise
|
|||||||
|
|
||||||
const deviceIdentityPath = path.join(
|
const deviceIdentityPath = path.join(
|
||||||
os.tmpdir(),
|
os.tmpdir(),
|
||||||
`openclaw-auth-device-${Date.now()}-${Math.random().toString(36).slice(2)}.json`,
|
"openclaw-auth-device-" + randomUUID() + ".json",
|
||||||
);
|
);
|
||||||
|
|
||||||
const res = await connectReq(ws, { token: "secret", deviceIdentityPath });
|
const res = await connectReq(ws, { token: "secret", deviceIdentityPath });
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const DEFAULT_GUARDRAIL_SKIP_PATTERNS = [
|
|||||||
/\.test-helpers\.tsx?$/,
|
/\.test-helpers\.tsx?$/,
|
||||||
/\.test-utils\.tsx?$/,
|
/\.test-utils\.tsx?$/,
|
||||||
/\.test-harness\.tsx?$/,
|
/\.test-harness\.tsx?$/,
|
||||||
|
/\.suite\.tsx?$/,
|
||||||
/\.e2e\.tsx?$/,
|
/\.e2e\.tsx?$/,
|
||||||
/\.d\.ts$/,
|
/\.d\.ts$/,
|
||||||
/[\\/](?:__tests__|tests|test-utils)[\\/]/,
|
/[\\/](?:__tests__|tests|test-utils)[\\/]/,
|
||||||
|
|||||||
Reference in New Issue
Block a user