v0.33.7
This commit is contained in:
1 parent
162e986d37
commit
6b937aaf85
54 files changed
+3527
-1325
No files matched your search
@@ -1,16 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
"""0.33.5 CPU plot autoscaling regression with production HTML/CSS/JS.
|
||||
"""Legacy CPU plot regression: low and high real values on a fixed 0-100% axis.
|
||||
|
||||
Uses Chromium with simulated authenticated DOM and status samples, not a live
|
||||
RustProxy server, SSE stream or real CPU telemetry.
|
||||
Autoscaling was intentionally replaced by 0.33.5 fixed scaling. This test
|
||||
retains the original history/reset and label checks using the current scale.
|
||||
Chromium is simulated, not a live RustProxy server.
|
||||
"""
|
||||
from pathlib import Path
|
||||
from panel_html import render_admin_index
|
||||
import re
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
HTML = (ROOT / 'src/admin/web/index.html').read_text(encoding='utf-8')
|
||||
HTML = render_admin_index(ROOT)
|
||||
CSS = (ROOT / 'src/admin/web/style.css').read_text(encoding='utf-8')
|
||||
SCALE_JS = (ROOT / 'src/admin/web/app/chart-scales.js').read_text(encoding='utf-8')
|
||||
WIDE_JS = (ROOT / 'src/admin/web/app/overview-wide-metrics.js').read_text(encoding='utf-8')
|
||||
|
||||
|
||||
@@ -83,6 +86,7 @@ with sync_playwright() as p:
|
||||
window.fmtBytes = value => `${value} B`;
|
||||
window.rustProxyOverviewSamples = {getLimit: () => 60, onChange: () => {}};
|
||||
}''')
|
||||
page.add_script_tag(content=SCALE_JS)
|
||||
page.add_script_tag(content=WIDE_JS)
|
||||
|
||||
for density in ('compact', 'normal', 'ultra'):
|
||||
@@ -97,21 +101,21 @@ with sync_playwright() as p:
|
||||
assert result['svgWidth'] > 100 and abs(result['svgWidth'] - result['drawnWidth']) < 2, result
|
||||
assert result['legendInCard'] and result['overflow'] <= 2, (viewport, density, result)
|
||||
|
||||
# Measured 0.5-0.8% must be visible, not flattened by a 100% ceiling.
|
||||
# Measured 0.5-0.8% stay numerically visible without axis auto-expansion.
|
||||
first = render_cpu(page, 1, 0.5, 0.2)
|
||||
second = render_cpu(page, 1, 0.8, 0.6)
|
||||
assert first['system']['label'] == '0.5%' and second['process']['label'] == '0.6%'
|
||||
assert ys(second['system']['path']) == [77, 41], (viewport, second)
|
||||
assert ys(second['process']['path']) == [113, 65], (viewport, second)
|
||||
assert ys(second['system']['path']) == [136, 136], (viewport, second)
|
||||
assert ys(second['process']['path']) == [137, 136], (viewport, second)
|
||||
|
||||
# The peak follows observed history and also works above 100% (multi-core).
|
||||
# Multi-core values display accurately but clip at the fixed 100% ceiling.
|
||||
third = render_cpu(page, 1, 3.4, 2.2)
|
||||
assert ys(third['system']['path'])[-1] == 17, (viewport, third)
|
||||
assert ys(third['process']['path'])[-1] == 59, (viewport, third)
|
||||
assert ys(third['system']['path'])[-1] == 133, (viewport, third)
|
||||
assert ys(third['process']['path'])[-1] == 134, (viewport, third)
|
||||
high = render_cpu(page, 1, 250, 123)
|
||||
assert high['system']['label'] == '250.0%'
|
||||
assert ys(high['system']['path'])[-1] == 17, (viewport, high)
|
||||
assert 17 <= ys(high['process']['path'])[-1] < 137, (viewport, high)
|
||||
assert ys(high['process']['path'])[-1] == 17, (viewport, high)
|
||||
|
||||
# Revision changes reset the history. Zero stays at the plot baseline.
|
||||
idle = render_cpu(page, 2, 0, 0)
|
||||
@@ -119,6 +123,6 @@ with sync_playwright() as p:
|
||||
missing = render_cpu(page, 3, None, None)
|
||||
assert missing['system']['path'] == '' and missing['process']['label'] == '-'
|
||||
assert not errors, (viewport, errors)
|
||||
print(f'PASS CPU auto Y-scale and standard plot height at {viewport}px (all densities)')
|
||||
print(f'PASS legacy CPU labels/history on fixed Y-scale at {viewport}px (all densities)')
|
||||
page.close()
|
||||
browser.close()
|
||||
Reference in new issue
Block a user