mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 01:28:27 +00:00
Skills: clean up remote node cache on disconnect
This commit is contained in:
36
src/infra/skills-remote.test.ts
Normal file
36
src/infra/skills-remote.test.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
getRemoteSkillEligibility,
|
||||
recordRemoteNodeBins,
|
||||
recordRemoteNodeInfo,
|
||||
removeRemoteNodeInfo,
|
||||
} from "./skills-remote.js";
|
||||
|
||||
describe("skills-remote", () => {
|
||||
it("removes disconnected nodes from remote skill eligibility", () => {
|
||||
const nodeId = `node-${randomUUID()}`;
|
||||
const bin = `bin-${randomUUID()}`;
|
||||
recordRemoteNodeInfo({
|
||||
nodeId,
|
||||
displayName: "Remote Mac",
|
||||
platform: "darwin",
|
||||
commands: ["system.run"],
|
||||
});
|
||||
recordRemoteNodeBins(nodeId, [bin]);
|
||||
|
||||
expect(getRemoteSkillEligibility()?.hasBin(bin)).toBe(true);
|
||||
|
||||
removeRemoteNodeInfo(nodeId);
|
||||
|
||||
expect(getRemoteSkillEligibility()?.hasBin(bin) ?? false).toBe(false);
|
||||
});
|
||||
|
||||
it("supports idempotent remote node removal", () => {
|
||||
const nodeId = `node-${randomUUID()}`;
|
||||
expect(() => {
|
||||
removeRemoteNodeInfo(nodeId);
|
||||
removeRemoteNodeInfo(nodeId);
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user