test: scope gateway restart signal assertion · openclaw/openclaw@4e3bf7c
steipete
·
2026-04-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -98,6 +98,10 @@ describe("gateway tool", () => {
|
98 | 98 | |
99 | 99 | it("schedules SIGUSR1 restart", async () => { |
100 | 100 | const kill = vi.spyOn(process, "kill").mockImplementation(() => true); |
| 101 | +const restartSignalKillCalls = () => |
| 102 | +kill.mock.calls.filter( |
| 103 | +([pid, signal]) => pid === process.pid && (signal === "SIGUSR1" || signal === undefined), |
| 104 | +); |
101 | 105 | const sigusr1Handler = vi.fn(); |
102 | 106 | process.on("SIGUSR1", sigusr1Handler); |
103 | 107 | const stateDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-test-")); |
@@ -119,13 +123,13 @@ describe("gateway tool", () => {
|
119 | 123 | delayMs: 0, |
120 | 124 | }); |
121 | 125 | |
122 | | -expect(kill).not.toHaveBeenCalled(); |
| 126 | +expect(restartSignalKillCalls()).toHaveLength(0); |
123 | 127 | expect(sigusr1Handler).not.toHaveBeenCalled(); |
124 | 128 | await vi.waitFor(() => expect(sigusr1Handler).toHaveBeenCalledTimes(1), { |
125 | 129 | interval: 1, |
126 | 130 | timeout: 1_000, |
127 | 131 | }); |
128 | | -expect(kill).not.toHaveBeenCalled(); |
| 132 | +expect(restartSignalKillCalls()).toHaveLength(0); |
129 | 133 | |
130 | 134 | const sentinelPath = path.join(stateDir, "restart-sentinel.json"); |
131 | 135 | const raw = await fs.readFile(sentinelPath, "utf-8"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。