





















@@ -4,6 +4,16 @@ import { asConfig, setupSecretsRuntimeSnapshotTestHooks } from "./runtime.test-s
44const EMPTY_LOADABLE_PLUGIN_ORIGINS = new Map();
55const { prepareSecretsRuntimeSnapshot } = setupSecretsRuntimeSnapshotTestHooks();
667+function expectWarning(
8+snapshot: Awaited<ReturnType<typeof prepareSecretsRuntimeSnapshot>>,
9+expected: { code: string; path: string },
10+): void {
11+const warning = snapshot.warnings.find(
12+(entry) => entry.code === expected.code && entry.path === expected.path,
13+);
14+expect(warning).toBeDefined();
15+}
16+717describe("secrets runtime snapshot", () => {
818it("resolves sandbox ssh secret refs for active ssh backends", async () => {
919const snapshot = await prepareSecretsRuntimeSnapshot({
@@ -40,11 +50,10 @@ describe("secrets runtime snapshot", () => {
4050loadablePluginOrigins: EMPTY_LOADABLE_PLUGIN_ORIGINS,
4151});
425243-expect(snapshot.config.agents?.defaults?.sandbox?.ssh).toMatchObject({
44-identityData: "PRIVATE KEY",
45-certificateData: "SSH CERT",
46-knownHostsData: "example.com ssh-ed25519 AAAATEST",
47-});
53+const ssh = snapshot.config.agents?.defaults?.sandbox?.ssh;
54+expect(ssh?.identityData).toBe("PRIVATE KEY");
55+expect(ssh?.certificateData).toBe("SSH CERT");
56+expect(ssh?.knownHostsData).toBe("example.com ssh-ed25519 AAAATEST");
4857});
49585059it("treats sandbox ssh secret refs as inactive when ssh backend is not selected", async () => {
@@ -72,14 +81,10 @@ describe("secrets runtime snapshot", () => {
7281provider: "default",
7382id: "SSH_IDENTITY_DATA",
7483});
75-expect(snapshot.warnings).toEqual(
76-expect.arrayContaining([
77-expect.objectContaining({
78-code: "SECRETS_REF_IGNORED_INACTIVE_SURFACE",
79-path: "agents.defaults.sandbox.ssh.identityData",
80-}),
81-]),
82-);
84+expectWarning(snapshot, {
85+code: "SECRETS_REF_IGNORED_INACTIVE_SURFACE",
86+path: "agents.defaults.sandbox.ssh.identityData",
87+});
8388});
84898590it("fails when an active exec ref id contains traversal segments", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。