mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 07:22:44 +00:00
test(perf): trim cron and audit fixture overhead
This commit is contained in:
@@ -149,7 +149,7 @@ function expectNoFinding(res: SecurityAuditReport, checkId: string): void {
|
||||
describe("security audit", () => {
|
||||
let fixtureRoot = "";
|
||||
let caseId = 0;
|
||||
let channelSecurityStateDir = "";
|
||||
let channelSecurityRoot = "";
|
||||
let sharedCodeSafetyStateDir = "";
|
||||
let sharedCodeSafetyWorkspaceDir = "";
|
||||
let sharedExtensionsStateDir = "";
|
||||
@@ -162,12 +162,11 @@ describe("security audit", () => {
|
||||
};
|
||||
|
||||
const withChannelSecurityStateDir = async (fn: (tmp: string) => Promise<void>) => {
|
||||
const channelSecurityStateDir = path.join(channelSecurityRoot, `state-${caseId++}`);
|
||||
const credentialsDir = path.join(channelSecurityStateDir, "credentials");
|
||||
await fs.rm(credentialsDir, { recursive: true, force: true });
|
||||
await fs.mkdir(credentialsDir, { recursive: true, mode: 0o700 });
|
||||
await withEnvAsync(
|
||||
{ OPENCLAW_STATE_DIR: channelSecurityStateDir },
|
||||
async () => await fn(channelSecurityStateDir),
|
||||
await withEnvAsync({ OPENCLAW_STATE_DIR: channelSecurityStateDir }, () =>
|
||||
fn(channelSecurityStateDir),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -213,11 +212,8 @@ description: test skill
|
||||
|
||||
beforeAll(async () => {
|
||||
fixtureRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-security-audit-"));
|
||||
channelSecurityStateDir = path.join(fixtureRoot, "channel-security");
|
||||
await fs.mkdir(path.join(channelSecurityStateDir, "credentials"), {
|
||||
recursive: true,
|
||||
mode: 0o700,
|
||||
});
|
||||
channelSecurityRoot = path.join(fixtureRoot, "channel-security");
|
||||
await fs.mkdir(channelSecurityRoot, { recursive: true, mode: 0o700 });
|
||||
const codeSafetyFixture = await createSharedCodeSafetyFixture();
|
||||
sharedCodeSafetyStateDir = codeSafetyFixture.stateDir;
|
||||
sharedCodeSafetyWorkspaceDir = codeSafetyFixture.workspaceDir;
|
||||
|
||||
Reference in New Issue
Block a user