test: spell out gateway warning output · openclaw/openclaw@cb0c757
shakkernerd
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -149,7 +149,7 @@ describe("runBootOnce", () => {
|
149 | 149 | agentCommand.mockRejectedValue(new Error("boom")); |
150 | 150 | await expect(runBootOnce({ cfg: {}, deps: makeDeps(), workspaceDir })).resolves.toEqual({ |
151 | 151 | status: "failed", |
152 | | -reason: expect.stringContaining("agent run failed: boom"), |
| 152 | +reason: "agent run failed: boom", |
153 | 153 | }); |
154 | 154 | expect(agentCommand).toHaveBeenCalledTimes(1); |
155 | 155 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1045,7 +1045,9 @@ describe("agent request events", () => {
|
1045 | 1045 | // server-node-events must log-and-return on parse failure — no agent |
1046 | 1046 | // dispatch, no crash, and the refusal reason bubbles up via logGateway. |
1047 | 1047 | expect(agentCommandMock).not.toHaveBeenCalled(); |
1048 | | -expect(warn).toHaveBeenCalledWith(expect.stringMatching(/attachment parse failed.*non-image/i)); |
| 1048 | +expect(warn).toHaveBeenCalledWith( |
| 1049 | +"agent.request attachment parse failed: attachment a.pdf: non-image attachments not supported", |
| 1050 | +); |
1049 | 1051 | }); |
1050 | 1052 | |
1051 | 1053 | beforeEach(() => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -124,7 +124,9 @@ describe("startGatewayMemoryBackend", () => {
|
124 | 124 | expect(log.info).toHaveBeenCalledWith( |
125 | 125 | 'qmd memory startup boot sync completed for 2 agents: "ops", "main"', |
126 | 126 | ); |
127 | | -expect(log.info).not.toHaveBeenCalledWith(expect.stringContaining("deferred")); |
| 127 | +expect(log.info.mock.calls.some(([message]) => String(message).includes("deferred"))).toBe( |
| 128 | +false, |
| 129 | +); |
128 | 130 | }); |
129 | 131 | |
130 | 132 | it("logs a warning when qmd manager init fails and continues with other agents", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -189,7 +189,7 @@ describe("gateway startup primary model warmup", () => {
|
189 | 189 | }); |
190 | 190 | |
191 | 191 | expect(warn).toHaveBeenCalledWith( |
192 | | -expect.stringContaining("startup model warmup failed for codex/gpt-5.4"), |
| 192 | +"startup model warmup failed for codex/gpt-5.4: Error: models write failed", |
193 | 193 | ); |
194 | 194 | }); |
195 | 195 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -168,10 +168,11 @@ describe("gateway plugin HTTP auth boundary", () => {
|
168 | 168 | "nosniff", |
169 | 169 | ); |
170 | 170 | expect(withoutHstsResponse.setHeader).toHaveBeenCalledWith("Referrer-Policy", "no-referrer"); |
171 | | -expect(withoutHstsResponse.setHeader).not.toHaveBeenCalledWith( |
172 | | -"Strict-Transport-Security", |
173 | | -expect.any(String), |
174 | | -); |
| 171 | +expect( |
| 172 | +withoutHstsResponse.setHeader.mock.calls.some( |
| 173 | +([headerName]) => headerName === "Strict-Transport-Security", |
| 174 | +), |
| 175 | +).toBe(false); |
175 | 176 | |
176 | 177 | const withHsts = createTestGatewayServer({ |
177 | 178 | resolvedAuth: AUTH_NONE, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -408,7 +408,7 @@ describe("createGatewayPluginRequestHandler", () => {
|
408 | 408 | const { res, setHeader, end } = makeMockHttpResponse(); |
409 | 409 | const handled = await handler({ url: "/boom" } as IncomingMessage, res); |
410 | 410 | expect(handled).toBe(true); |
411 | | -expect(log.warn).toHaveBeenCalledWith(expect.stringContaining("boom")); |
| 411 | +expect(log.warn).toHaveBeenCalledWith("plugin http route failed (route): Error: boom"); |
412 | 412 | expect(res.statusCode).toBe(500); |
413 | 413 | expect(setHeader).toHaveBeenCalledWith("Content-Type", "text/plain; charset=utf-8"); |
414 | 414 | expect(end).toHaveBeenCalledWith("Internal Server Error"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,9 @@ describe("maybeSeedControlUiAllowedOriginsAtStartup", () => {
|
16 | 16 | const expectedOrigins = ["http://localhost:3000", "http://127.0.0.1:3000"]; |
17 | 17 | expect(result.seededAllowedOrigins).toBe(true); |
18 | 18 | expect(result.config.gateway?.controlUi?.allowedOrigins).toEqual(expectedOrigins); |
19 | | -expect(log.info).toHaveBeenCalledWith(expect.stringContaining("for bind=lan")); |
| 19 | +expect(log.info).toHaveBeenCalledWith( |
| 20 | +'gateway: seeded gateway.controlUi.allowedOrigins ["http://localhost:3000","http://127.0.0.1:3000"] for bind=lan (required since v2026.2.26; see issue #29385). Applied for this runtime without writing config; add other origins to gateway.controlUi.allowedOrigins if needed.', |
| 21 | +); |
20 | 22 | expect(log.warn).not.toHaveBeenCalled(); |
21 | 23 | }); |
22 | 24 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。