Skip to content

PMM-12279 Add e2e test for MySQL Performance Schema memory panels - #1142

Open
theTibi wants to merge 1 commit into
mainfrom
PMM-12279
Open

PMM-12279 Add e2e test for MySQL Performance Schema memory panels#1142
theTibi wants to merge 1 commit into
mainfrom
PMM-12279

Conversation

@theTibi

@theTibi theTibi commented Aug 6, 2026

Copy link
Copy Markdown

What

Adds Playwright (e2e_tests/) coverage for the Performance Schema Memory panels introduced in percona/pmm#5649, which enables the perf_schema.memory_events collector and adds memory panels to the MySQL Performance Schema Details dashboard.

Jira: PMM-12279

Changes

  • New page object pages/dashboards/mysql/mysqlPerformanceSchemaDetails.ts for the MySQL Performance Schema Details dashboard (uid mysql-performance-schema). Includes the full panel inventory plus a memoryMetrics subset for the three new panels. The dashboard previously had no e2e coverage.
  • Registered it in pages/dashboards/mysql/index.ts.
  • New scenario in tests/dashboards/mysql/mysqlDashboards.test.ts (tag @pmm-ps-integration):
    • asserts the three memory panels are present, and
    • asserts Memory Usage — Current Bytes Used (Top 15 by Event) renders real data end-to-end (collector → VictoriaMetrics → panel).

How to test

cd e2e_tests
npx playwright test --grep "PMM-12279"

Requires a PMM environment with a Percona Server / MySQL 8.0+ service added with --query-source=perfschema (the ps_pmm service in the @pmm-ps-integration setup). Memory instruments are enabled by default on PS/MySQL 8.0+, so the Current Bytes Used panel is populated without extra server config.

Notes / follow-ups

  • Zephyr id: the scenario currently uses placeholder PMM-T0000 (marked with a TODO). Needs to be replaced with the reserved test-case id before merge.
  • Rate panels: Memory Allocation Rate and Memory Free Rate use rate(...) > 0, so they can legitimately be empty under idle load. They are allow-listed in noDataMetrics; the test asserts data only on the always-populated Current Bytes Used panel to avoid flakiness.
  • No qa-integration provisioning changes were needed. Enabling performance-schema-instrument='memory/%=ON' on the test server (to also exercise the rate panels) can be a later hardening step.

Depends on percona/pmm#5649 being merged for the panels to exist in the shipped dashboard.

🤖 Generated with Claude Code

Adds Playwright coverage for the Performance Schema Memory panels introduced
in percona/pmm#5649 (perf_schema.memory_events collector):

- New page object MysqlPerformanceSchemaDetails for the MySQL Performance
  Schema Details dashboard (uid mysql-performance-schema), including the three
  memory panels and the full panel inventory.
- Registers it in the MySQL dashboards index.
- New @pmm-ps-integration scenario: asserts the memory panels are present and
  that the Current Bytes Used panel renders real data end-to-end
  (collector -> VictoriaMetrics -> panel).
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The change adds the MySQL Performance Schema Details dashboard page model, registers it in MysqlDashboards, and adds end-to-end coverage for its memory panels and Current Bytes Used data.

Changes

MySQL Performance Schema coverage

Layer / File(s) Summary
Dashboard definition and registration
e2e_tests/pages/dashboards/mysql/mysqlPerformanceSchemaDetails.ts, e2e_tests/pages/dashboards/mysql/index.ts
The new page model defines dashboard metadata, memory panels, no-data exceptions, and metricsWithData. MysqlDashboards registers the page model.
Performance Schema memory validation
e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts
The end-to-end test opens the dashboard with a 15-minute range and 5-second refresh, checks the memory metrics, and verifies data in Current Bytes Used.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the new e2e test for MySQL Performance Schema memory panels.
Description check ✅ Passed The description directly explains the new page object, dashboard registration, test scenario, dependencies, and test requirements.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts (1)

193-212: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add explicit pmmTest.step() blocks.

Wrap navigation, panel-presence validation, and data validation in separate pmmTest.step() calls. This makes the test report identify the failed operation.

Proposed structure
+    await pmmTest.step('Open the Performance Schema Details dashboard', async () => {
     await page.goto(
       urlHelper.buildUrlWithParameters(dashboard.mysql.mysqlPerformanceSchemaDetails.url, {
         from: 'now-15m',
         refresh: '5s',
         serviceName: service_name,
       }),
     );
+    });
 
+    await pmmTest.step('Verify Performance Schema Memory panels', async () => {
     await dashboard.verifyMetricsPresent(dashboard.mysql.mysqlPerformanceSchemaDetails.memoryMetrics);
+    });
 
+    await pmmTest.step('Verify Current Bytes Used panel data', async () => {
     await dashboard.verifyNamedPanelsHaveData([
       dashboard.mysql.mysqlPerformanceSchemaDetails.memoryCurrentUsedPanel,
     ]);
+    });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts` around lines 193 -
212, Update the dashboard test callback to wrap navigation, metric/panel
presence validation, and panel data validation in separate pmmTest.step()
blocks. Keep the existing url construction and verification calls unchanged,
assigning each block a descriptive step name so reports identify which operation
failed.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts`:
- Around line 190-192: Update the test title in pmmTest for PMM-12279 by
replacing the PMM-T0000 placeholder with the reserved Zephyr test-case ID. Keep
the rest of the title and test behavior unchanged.
- Line 194: Update the service selection around getServiceDetailsByRegex to
choose or validate a MySQL 8.0+ service configured with query-source=perfschema,
rather than relying on the ambiguous ps_pmm match. Ensure the selected service
has the required collector configuration before performing the memory-panel
checks.

---

Nitpick comments:
In `@e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts`:
- Around line 193-212: Update the dashboard test callback to wrap navigation,
metric/panel presence validation, and panel data validation in separate
pmmTest.step() blocks. Keep the existing url construction and verification calls
unchanged, assigning each block a descriptive step name so reports identify
which operation failed.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0cb804dd-8977-4669-b461-c7ca27373447

📥 Commits

Reviewing files that changed from the base of the PR and between b93a703 and a4e873e.

📒 Files selected for processing (3)
  • e2e_tests/pages/dashboards/mysql/index.ts
  • e2e_tests/pages/dashboards/mysql/mysqlPerformanceSchemaDetails.ts
  • e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • percona/pmm-qa (manual)
  • percona/pmm (manual) → reviewed against open PR #5649 PMM-12279 instead of the default branch

Comment on lines +190 to +192
// TODO: replace PMM-T0000 with the Zephyr test-case id reserved for PMM-12279.
pmmTest(
'PMM-T0000 - Verify Performance Schema Memory panels on MySQL Performance Schema Details Dashboard (PMM-12279) @pmm-ps-integration',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Replace the placeholder Zephyr ID before merge.

PMM-T0000 does not provide test-case traceability. Replace it with the reserved Zephyr ID.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts` around lines 190 -
192, Update the test title in pmmTest for PMM-12279 by replacing the PMM-T0000
placeholder with the reserved Zephyr test-case ID. Keep the rest of the title
and test behavior unchanged.

pmmTest(
'PMM-T0000 - Verify Performance Schema Memory panels on MySQL Performance Schema Details Dashboard (PMM-12279) @pmm-ps-integration',
async ({ api, dashboard, page, urlHelper }) => {
const { service_name } = await api.inventoryApi.getServiceDetailsByRegex('ps_pmm');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -i -C 4 \
  'ps_pmm|query[-_]?source.*perfschema|perfschema.*query[-_]?source|mysql.*8(\.0)?' \
  . -g '!node_modules/**' -g '!dist/**' -g '!build/**'

Repository: percona/pmm-qa

Length of output: 50371


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- target test ---'
sed -n '150,225p' e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts

printf '%s\n' '--- service selector implementation and usages ---'
rg -n -C 6 'getServiceDetailsByRegex|ps_pmm' e2e_tests --glob '*.ts' --glob '*.yml'

printf '%s\n' '--- environment/setup references for the default ps_pmm service ---'
rg -n -i -C 5 'mysql_service_name|service_name.*ps|ps[_-]pmm|mysql_version|query-source=perfschema' \
  qa-integration package_tests e2e_tests --glob '*.yml' --glob '*.yaml' --glob '*.ts' --glob '*.sh' \
  | head -n 500

Repository: percona/pmm-qa

Length of output: 50370


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- Percona Server setup ---'
sed -n '1,240p' qa-integration/pmm_qa/percona_server_for_mysql/percona-server-setup.yml

printf '%s\n' '--- Percona Server setup files and version/service-name definitions ---'
rg -n -C 4 'ps_version|query_source|service_name|pmm-admin add mysql|container_prefix|mysql_version' \
  qa-integration/pmm_qa/percona_server_for_mysql \
  qa-integration/pmm_qa --glob '*.yml' --glob '*.yaml' --glob '*.j2' --glob '*.sh' \
  | head -n 800

printf '%s\n' '--- test configuration and database matrix ---'
rg -n -i -C 4 'pmm-ps-integration|percona.*mysql|ps_version|QUERY_SOURCE|SETUP_TYPE|mysql.*8.0|mysql.*5.7' \
  e2e_tests package.json playwright.config.* qa-integration --glob '*.ts' --glob '*.js' --glob '*.json' \
  --glob '*.yml' --glob '*.yaml' --glob '*.env*' --glob '*.sh' \
  | head -n 800

Repository: percona/pmm-qa

Length of output: 50371


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- callers of the Percona Server setup ---'
rg -n -C 6 'percona-server-setup\.yml|percona_server_for_mysql|PS_VERSION|QUERY_SOURCE|SETUP_TYPE' \
  .github qa-integration scripts Makefile* package.json 2>/dev/null \
  | head -n 1000

printf '%s\n' '--- all setup entry points and workflow environment ---'
git ls-files | rg '(^|/)(workflows|.*workflow.*|.*setup.*|.*config.*)' \
  | rg -i 'ya?ml$|json$|sh$|ts$|js$' \
  | head -n 300

printf '%s\n' '--- exact collector prerequisite references ---'
rg -n -i -C 6 'memory_events|perf_schema.*memory|memory.*perf_schema|query.?source|8\.0\+' \
  e2e_tests qa-integration .github --glob '*.ts' --glob '*.yml' --glob '*.yaml' --glob '*.sh' \
  | head -n 1000

Repository: percona/pmm-qa

Length of output: 50370


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- PS framework registration and argument forwarding ---'
sed -n '1,150p' qa-integration/pmm_qa/pmm-framework/lib/config.sh
rg -n -C 8 'PS\b|PS_VERSION|QUERY_SOURCE|database.*ps|ansible.*percona|percona-server-setup' \
  qa-integration/pmm_qa/pmm-framework \
  qa-integration/pmm_qa/scripts \
  .github/workflows/runner-e2e-tests-playwright.yml \
  | head -n 1000

printf '%s\n' '--- inventory response shape and service fields ---'
sed -n '1,120p' e2e_tests/api/inventory.api.ts
rg -n -C 4 'interface GetService|type GetService|query.?source|query_source|service_type|service_name' \
  e2e_tests --glob '*.ts' | head -n 600

printf '%s\n' '--- deterministic setup/selector verifier ---'
python3 - <<'PY'
from pathlib import Path
import re

setup = Path("qa-integration/pmm_qa/percona_server_for_mysql/percona-server-setup.yml").read_text()
workflow = Path(".github/workflows/fb-e2e-suite.yml").read_text()
test = Path("e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts").read_text()

assert "getServiceDetailsByRegex('ps_pmm')" in test
assert "SETUP_TYPE=replication" in workflow
assert "SETUP_TYPE=gr,QUERY_SOURCE=slowlog" in workflow

prefix = "ps_pmm{suffix}_{version}_"
for setup_type, query_source in [("replication", "perfschema"), ("gr", "slowlog")]:
    suffix = f"_{setup_type}"
    name = prefix.format(suffix=suffix, version="8_0") + "1_12345"
    assert re.search(r"ps_pmm", name)
    print(f"{name}: query_source={query_source}, matches ps_pmm=True")

print("The workflow creates both a perfschema service and a slowlog service.")
print("The test regex matches both service-name families.")
print("The selector does not constrain query_source or MySQL version.")
PY

Repository: percona/pmm-qa

Length of output: 50373


Select a service with the required collector configuration.

getServiceDetailsByRegex('ps_pmm') can select the group-replication service configured with slowlog, or a MySQL 5.7 service. Select or validate a MySQL 8.0+ service configured with query-source=perfschema before checking the memory panels.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts` at line 194, Update
the service selection around getServiceDetailsByRegex to choose or validate a
MySQL 8.0+ service configured with query-source=perfschema, rather than relying
on the ambiguous ps_pmm match. Ensure the selected service has the required
collector configuration before performing the memory-panel checks.

@travagliad travagliad added the blocked PR is Blocked to be merged label Aug 14, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked PR is Blocked to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants