diff --git a/CHANGES.md b/CHANGES.md index 86d113c..a6d1cb2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,13 @@ # Changelog +## 1.0.0b69 (unreleased) + +### Fixed + +- The Slow Queries tab's empty-state message now shows the actually-configured + threshold (via `manage_get_slow_query_threshold()`) instead of hard-coding the + `PGCATALOG_SLOW_QUERY_MS` default of 10 ms. + ## 1.0.0b68 (2026-06-30) ### Removed diff --git a/src/plone/pgcatalog/www/catalogSlowQueries.dtml b/src/plone/pgcatalog/www/catalogSlowQueries.dtml index bb12b67..00145d9 100644 --- a/src/plone/pgcatalog/www/catalogSlowQueries.dtml +++ b/src/plone/pgcatalog/www/catalogSlowQueries.dtml @@ -84,8 +84,9 @@

No slow queries recorded yet. - Queries exceeding the threshold (PGCATALOG_SLOW_QUERY_MS, - default 10ms) are logged here automatically. + Queries exceeding the configured threshold + (ms, set via + PGCATALOG_SLOW_QUERY_MS) are logged here automatically.

diff --git a/tests/test_slow_queries_view.py b/tests/test_slow_queries_view.py new file mode 100644 index 0000000..dadc1b5 --- /dev/null +++ b/tests/test_slow_queries_view.py @@ -0,0 +1,27 @@ +"""The Slow Queries empty-state shows the configured threshold, not the default. + +The "no slow queries yet" message used to hard-code the env var name and its +`default 10ms`; it now surfaces the actually-configured threshold via +`manage_get_slow_query_threshold()`. +""" + +import pathlib + + +_DTML = ( + pathlib.Path(__file__).parent.parent + / "src" + / "plone" + / "pgcatalog" + / "www" + / "catalogSlowQueries.dtml" +) + + +def test_empty_state_uses_configured_threshold(): + text = _DTML.read_text() + empty_state = text.split("No slow queries recorded yet.", 1)[1] + # Shows the actual value via the view method ... + assert "manage_get_slow_query_threshold()" in empty_state + # ... and no longer hard-codes the default. + assert "default 10ms" not in empty_state