test(macos): avoid real approvals migration in tests · openclaw/openclaw@894f521
vincentkoc
·
2026-06-14
·
via Recent Commits to openclaw:main
File tree
apps/macos/Tests/OpenClawIPCTests
| Original file line number | Diff line number | Diff line change |
|---|
@@ -56,6 +56,7 @@ struct ExecApprovalsStoreRefactorTests {
|
56 | 56 | let home = root.appendingPathComponent("home", isDirectory: true) |
57 | 57 | let stateDir = root.appendingPathComponent("state", isDirectory: true) |
58 | 58 | defer { try? FileManager().removeItem(at: root) } |
| 59 | +try Self.seedCurrentApprovalsFile(in: stateDir) |
59 | 60 | |
60 | 61 | try await self.withLockedEnv([ |
61 | 62 | "OPENCLAW_HOME": home.path, |
@@ -196,4 +197,19 @@ struct ExecApprovalsStoreRefactorTests {
|
196 | 197 | } |
197 | 198 | return identifier |
198 | 199 | } |
| 200 | + |
| 201 | +private static func seedCurrentApprovalsFile(in stateDir: URL) throws { |
| 202 | +try FileManager().createDirectory(at: stateDir, withIntermediateDirectories: true) |
| 203 | +let file = ExecApprovalsFile( |
| 204 | + version: 1, |
| 205 | + socket: ExecApprovalsSocketConfig( |
| 206 | + path: stateDir.appendingPathComponent("exec-approvals.sock").path, |
| 207 | + token: "test-token"), |
| 208 | + defaults: nil, |
| 209 | + agents: [:]) |
| 210 | +let encoder = JSONEncoder() |
| 211 | + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] |
| 212 | +try encoder.encode(file) |
| 213 | +.write(to: stateDir.appendingPathComponent("exec-approvals.json")) |
| 214 | +} |
199 | 215 | } |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。