



















@@ -144,6 +144,7 @@ type PluginFixtureResult = {
144144};
145145146146type CliOptions = {
147+allowFailures: boolean;
147148cases: GatewayBenchCase[];
148149entry: string;
149150json: boolean;
@@ -294,6 +295,7 @@ function resolveCases(caseIds: string[]): GatewayBenchCase[] {
294295295296function parseOptions(): CliOptions {
296297return {
298+allowFailures: hasFlag("--allow-failures"),
297299cases: resolveCases(parseRepeatableFlag("--case")),
298300entry: resolveEntry(parseFlagValue("--entry")),
299301json: hasFlag("--json"),
@@ -327,6 +329,7 @@ Options:
327329 --post-ready-delay-ms <ms> Resource snapshot delay after next ready (default: ${DEFAULT_POST_READY_DELAY_MS})
328330 --output <path> Write machine-readable JSON to a file
329331 --json Emit machine-readable JSON
332+ --allow-failures Exit 0 even when restart failures are measured
330333 --help, -h Show this text
331334332335Case ids:
@@ -1605,6 +1608,16 @@ function printResult(result: CaseResult): void {
16051608}
16061609}
160716101611+function hasBenchmarkFailures(results: CaseResult[]): boolean {
1612+return results.some(
1613+(result) => result.summary.failureRate > 0 || result.summary.firstFailureCode !== null,
1614+);
1615+}
1616+1617+function shouldFailBenchmark(results: CaseResult[], options: { allowFailures: boolean }): boolean {
1618+return !options.allowFailures && hasBenchmarkFailures(results);
1619+}
1620+16081621async function main() {
16091622if (hasHelpFlag()) {
16101623printUsage();
@@ -1644,11 +1657,17 @@ async function main() {
16441657}
16451658if (options.json) {
16461659console.log(JSON.stringify(payload, null, 2));
1660+if (shouldFailBenchmark(results, options)) {
1661+process.exitCode = 1;
1662+}
16471663return;
16481664}
16491665for (const result of results) {
16501666printResult(result);
16511667}
1668+if (shouldFailBenchmark(results, options)) {
1669+process.exitCode = 1;
1670+}
16521671}
1653167216541673export const testing = {
@@ -1663,11 +1682,13 @@ export const testing = {
16631682 finalizeRestartIteration,
16641683 flushOutputLineBuffers,
16651684 hasInitialReadyLogs,
1685+ hasBenchmarkFailures,
16661686 parseNonNegativeInt,
16671687 parsePositiveInt,
16681688 resolveRestartDeadlineFailure,
16691689 resolveEntry,
16701690 sanitizedEnv,
1691+ shouldFailBenchmark,
16711692 summarizeCase,
16721693 waitForRestartProbe,
16731694 writeConfig,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。