fix(scripts): accept forwarded otel smoke args · openclaw/openclaw@5367ef7
vincentkoc
·
2026-05-31
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,6 +10,7 @@ import { tmpdir } from "node:os";
|
10 | 10 | import path from "node:path"; |
11 | 11 | import { pathToFileURL } from "node:url"; |
12 | 12 | import { gunzipSync } from "node:zlib"; |
| 13 | +import { stripLeadingPackageManagerSeparator } from "./lib/arg-utils.mjs"; |
13 | 14 | |
14 | 15 | type CollectorMode = "local" | "docker"; |
15 | 16 | |
@@ -169,6 +170,7 @@ Collector container in front of the receiver.
|
169 | 170 | } |
170 | 171 | |
171 | 172 | function parseArgs(argv: string[]): CliOptions { |
| 173 | +const args = stripLeadingPackageManagerSeparator(argv); |
172 | 174 | const options: CliOptions = { |
173 | 175 | collectorMode: "local", |
174 | 176 | outputDir: path.join(".artifacts", "qa-e2e", `otel-smoke-${Date.now().toString(36)}`), |
@@ -177,14 +179,14 @@ function parseArgs(argv: string[]): CliOptions {
|
177 | 179 | help: false, |
178 | 180 | }; |
179 | 181 | |
180 | | -for (let index = 0; index < argv.length; index += 1) { |
181 | | -const arg = argv[index]; |
| 182 | +for (let index = 0; index < args.length; index += 1) { |
| 183 | +const arg = args[index]; |
182 | 184 | if (arg === "--help" || arg === "-h") { |
183 | 185 | options.help = true; |
184 | 186 | continue; |
185 | 187 | } |
186 | 188 | const readValue = () => { |
187 | | -const value = argv[index + 1]?.trim(); |
| 189 | +const value = args[index + 1]?.trim(); |
188 | 190 | if (!value) { |
189 | 191 | throw new Error(`${arg} requires a value`); |
190 | 192 | } |
@@ -1334,6 +1336,7 @@ async function main() {
|
1334 | 1336 | export const testing = { |
1335 | 1337 | appendCapturedBodyText, |
1336 | 1338 | decodeRequestBody, |
| 1339 | + parseArgs, |
1337 | 1340 | readPositiveIntegerEnv, |
1338 | 1341 | readRequestBody, |
1339 | 1342 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,6 +4,24 @@ import { describe, expect, it } from "vitest";
|
4 | 4 | import { testing } from "../../scripts/qa-otel-smoke.ts"; |
5 | 5 | |
6 | 6 | describe("qa-otel-smoke receiver bounds", () => { |
| 7 | +it("accepts package-manager forwarded arguments", () => { |
| 8 | +expect( |
| 9 | +testing.parseArgs([ |
| 10 | +"--", |
| 11 | +"--collector", |
| 12 | +"docker", |
| 13 | +"--provider-mode", |
| 14 | +"mock-openai", |
| 15 | +"--scenario", |
| 16 | +"otel-trace-smoke", |
| 17 | +]), |
| 18 | +).toMatchObject({ |
| 19 | +collectorMode: "docker", |
| 20 | +providerMode: "mock-openai", |
| 21 | +scenarioId: "otel-trace-smoke", |
| 22 | +}); |
| 23 | +}); |
| 24 | + |
7 | 25 | it("parses body-size limit env values as strict positive integers", () => { |
8 | 26 | expect(testing.readPositiveIntegerEnv("OTEL_TEST_LIMIT", 64, {})).toBe(64); |
9 | 27 | expect( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。