mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix(e2e): reject loose docker stats CPU samples
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user