fix(e2e): reject loose docker stats CPU samples

This commit is contained in:
Vincent Koc
2026-06-18 20:57:48 +02:00
parent 9ab9469d04
commit f381dca15b
2 changed files with 11 additions and 1 deletions
@@ -57,7 +57,12 @@ function parseMemoryMiB(raw) {
}
function parseCpuPercent(raw) {
const parsed = Number(String(raw || "").replace(/%$/u, ""));
const text = String(raw ?? "").trim();
const valueText = text.endsWith("%") ? text.slice(0, -1).trim() : text;
if (!NON_NEGATIVE_DECIMAL_PATTERN.test(valueText)) {
return undefined;
}
const parsed = Number(valueText);
return Number.isFinite(parsed) ? parsed : undefined;
}