From d5236171cc12ad0c5beb9c5bd1ef77ec7d5c0198 Mon Sep 17 00:00:00 2001 From: Michal Date: Sun, 19 Apr 2026 22:55:39 +0100 Subject: [PATCH] fix(smoke): use json output for llm apiKeyRef assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The table KEY column truncates at ~34 chars so `secret:///` wasn't appearing verbatim in stdout — the assertion was correct but brittle against presentation choices. Switched to `-o json` where the ref round-trips as a structured object, which is what actually matters. Caught by the live-cluster smoke run right after Phase 0-4 rolled out. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/mcplocal/tests/smoke/llm.smoke.test.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mcplocal/tests/smoke/llm.smoke.test.ts b/src/mcplocal/tests/smoke/llm.smoke.test.ts index d9841a5..2e20b23 100644 --- a/src/mcplocal/tests/smoke/llm.smoke.test.ts +++ b/src/mcplocal/tests/smoke/llm.smoke.test.ts @@ -121,10 +121,16 @@ describe('llm smoke', () => { it('get llms shows the row with KEY column rendered as "secret://name/key"', () => { if (!mcpdUp) return; - const result = run('get llms'); + // Table output truncates the KEY column (≈34 chars), so the full + // "secret:///" string won't appear verbatim in the row. Assert + // against JSON output where the apiKeyRef round-trips as a structured + // object. + const result = run('get llms -o json'); expect(result.code).toBe(0); - expect(result.stdout).toContain(LLM_NAME); - expect(result.stdout).toContain(`secret://${SECRET_NAME}/token`); + const rows = JSON.parse(result.stdout) as Array<{ name: string; apiKeyRef?: { name: string; key: string } }>; + const row = rows.find((r) => r.name === LLM_NAME); + expect(row, `row ${LLM_NAME} must be present`).toBeDefined(); + expect(row!.apiKeyRef).toEqual({ name: SECRET_NAME, key: 'token' }); }); it('round-trips yaml output → apply -f', () => {