qa/1337: harden MSSQL PMDA test for mssql-tools18 and improve value parsing#2594
Conversation
…arsing Support mssql-tools18 path with -C flag, fall back to legacy mssql-tools, and use _wait_for_port 1433 when sqlservr binary is absent. SQL queries now select only cntr_value, and new helper functions (_sql_scalar_from_sqlcmd_out, _pm_value_from_pmprobe_out) robustly extract numeric values for comparison. Cumulative metrics (Logins/sec, Logouts/sec) use a wider 20% tolerance.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe QA 1337 script improves SQLCMD discovery and TLS detection, waits for SQL Server readiness on port 1433, refactors SQL execution/output parsing into dedicated helpers that validate scalar and pmprobe outputs, and updates metric queries to fetch ChangesSQL Server QA Script Refactor
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@qa/1337`:
- Around line 135-136: The failure message hard-codes "10%" while the script
uses the caller-supplied $tolerance; update the call to _fail in the block that
calls _within_tolerance so it embeds the $tolerance variable (e.g. use
"$tolerance%") instead of "10%" and keep the same context variables ($metric,
$pcpvalue, $sqlvalue) so the message reads like: "$metric outside ${tolerance}%
tolerance (PCP $pcpvalue vs SQL $sqlvalue)".
- Around line 62-80: _sql_scalar_from_sqlcmd_out currently treats the first
numeric line as a scalar and exits immediately, which hides multi-row results;
update the function to scan all non-empty, non-header lines, collect numeric
matches instead of exiting on the first, and then: if exactly one numeric value
was found print it and exit 0, otherwise do not print a value and exit non‑zero
to signal an error (so callers detect multi-row results). Ensure changes are
made inside the _sql_scalar_from_sqlcmd_out awk program block referenced in the
diff so it counts numeric lines and enforces the single-row requirement.
🪄 Autofix (Beta)
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e1d34f71-004d-4724-94d6-12c7c37d9234
📒 Files selected for processing (1)
qa/1337
Support mssql-tools18 path with -C flag, fall back to legacy mssql-tools.
Use _wait_for_port 1433 when sqlservr binary is absent.
SQL queries now select only cntr_value, and new helper functions (_sql_scalar_from_sqlcmd_out, _pm_value_from_pmprobe_out) robustly extract numeric values for comparison.
Cumulative metrics (Logins/sec, Logouts/sec) use a wider 20% tolerance.
Summary by CodeRabbit