mirror of
https://github.com/nicolargo/glances.git
synced 2026-05-19 12:10:02 -04:00
Merge branch 'develop' of github.com:nicolargo/glances into develop
This commit is contained in:
6
Makefile
6
Makefile
@@ -120,6 +120,9 @@ test-webui: ## Run WebUI unit tests
|
||||
test-xmlrpc: ## Run XMLRPC API unit tests
|
||||
$(UV_RUN) run pytest tests/test_xmlrpc.py
|
||||
|
||||
test-plugins: ## Run all plugin unit tests
|
||||
$(UV_RUN) run pytest tests/test_plugin_*.py
|
||||
|
||||
test-with-upgrade: venv-upgrade test ## Upgrade deps and run unit tests
|
||||
|
||||
test-export-csv: ## Run interface tests with CSV
|
||||
@@ -140,7 +143,8 @@ test-export-timescaledb: ## Run interface tests with TimescaleDB
|
||||
test-export-nats: ## Run interface tests with NATS
|
||||
/bin/bash ./tests/test_export_nats.sh
|
||||
|
||||
test-exports: test-export-csv test-export-json test-export-influxdb-v1 test-export-influxdb-v3 test-export-timescaledb test-export-nats ## Tests all exports
|
||||
test-exports: ## Tests all exports
|
||||
@for f in ./tests/test_export_*.sh; do /bin/bash "$$f"; done
|
||||
|
||||
# ===================================================================
|
||||
# Linters, profilers and cyber security
|
||||
|
||||
@@ -48,6 +48,8 @@ to improve performance. More information can be found here: https://linuxatemyra
|
||||
If you want to display the "available" memory instead of the "free" memory, you can uses the
|
||||
the following configuration key in the Glances configuration file:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[mem]
|
||||
# Display available memory instead of used memory
|
||||
available=True
|
||||
|
||||
@@ -193,6 +193,7 @@ class GlancesRestfulApi:
|
||||
def load_config(self, config):
|
||||
"""Load the outputs section of the configuration file."""
|
||||
# Limit the number of processes to display in the WebUI
|
||||
# Default values
|
||||
self.url_prefix = ''
|
||||
self.protocol = 'http'
|
||||
self.ssl_keyfile = None
|
||||
@@ -452,9 +453,6 @@ class GlancesRestfulApi:
|
||||
"""
|
||||
refresh_time = request.query_params.get('refresh', default=max(1, int(self.args.time)))
|
||||
|
||||
# Update the stat
|
||||
self.__update_stats()
|
||||
|
||||
# Display
|
||||
return self._templates.TemplateResponse("index.html", {"request": request, "refresh_time": refresh_time})
|
||||
|
||||
|
||||
@@ -63,7 +63,8 @@ def test_screenshot(glances_webserver, glances_homepage):
|
||||
"""
|
||||
Test Glances home page screenshot.
|
||||
"""
|
||||
glances_webserver is not None
|
||||
if glances_webserver is None:
|
||||
raise AssertionError("Glances webserver is not running")
|
||||
for resolution in SCREENSHOT_RESOLUTIONS:
|
||||
glances_homepage.set_window_size(*resolution)
|
||||
glances_homepage.save_screenshot(
|
||||
@@ -75,29 +76,35 @@ def test_loading_time(glances_webserver, glances_homepage):
|
||||
"""
|
||||
Test Glances home page loading time.
|
||||
"""
|
||||
assert glances_webserver is not None
|
||||
if glances_webserver is None:
|
||||
raise AssertionError("Glances webserver is not running")
|
||||
navigation_start = glances_homepage.execute_script("return window.performance.timing.navigationStart")
|
||||
response_start = glances_homepage.execute_script("return window.performance.timing.responseStart")
|
||||
dom_complete = glances_homepage.execute_script("return window.performance.timing.domComplete")
|
||||
backend_perf = response_start - navigation_start
|
||||
frontend_perf = dom_complete - response_start
|
||||
assert backend_perf < 1000 # ms
|
||||
assert frontend_perf < 1000 # ms
|
||||
if backend_perf >= 2000:
|
||||
raise AssertionError(f"Backend performance is too slow: {backend_perf}ms (limit is 2000ms)")
|
||||
if frontend_perf >= 2000:
|
||||
raise AssertionError(f"Frontend performance is too slow: {frontend_perf}ms (limit is 2000ms)")
|
||||
|
||||
|
||||
def test_title(glances_webserver, glances_homepage):
|
||||
"""
|
||||
Test Glances home page title.
|
||||
"""
|
||||
assert glances_webserver is not None
|
||||
assert "Glances" in glances_homepage.title
|
||||
if glances_webserver is None:
|
||||
raise AssertionError("Glances webserver is not running")
|
||||
if "Glances" not in glances_homepage.title:
|
||||
raise AssertionError(f"Expected 'Glances' in title, but got '{glances_homepage.title}'")
|
||||
|
||||
|
||||
def test_plugins(glances_webserver, glances_homepage):
|
||||
"""
|
||||
Test Glances defaults plugins.
|
||||
"""
|
||||
assert glances_webserver is not None
|
||||
if glances_webserver is None:
|
||||
raise AssertionError("Glances webserver is not running")
|
||||
for plugin in [
|
||||
"system",
|
||||
"now",
|
||||
|
||||
Reference in New Issue
Block a user