Repository navigation
Fix MariaDB 11.x collation error in the v4 backfill and log schema fa… - #18
Conversation
…ilures The v4 device backfill compared JSON_TYPE() output (server default utf8mb3_uca1400_ai_ci on MariaDB 11.x) with a literal in Cacti's connection collation (utf8mb3_general_ci), failing with error 1267 and leaving the plugin at "Awaiting Configuration". Compare the bytes with CAST(... AS BINARY) instead. Schema steps also failed silently; every failure path now logs the step, reason and database error to the Cacti log. Fixes #15
somethingwithproof
left a comment
There was a problem hiding this comment.
Blocker: the new failure-reporting paths in includes/schema.php fail the existing changed-line coverage gate in all five CI jobs: 11/33 executable lines covered (33.33%). SetupTest covers the v4 write failure and a direct helper call, but leaves the other changed migration failure branches unexercised. Extend the existing tests to drive those database-read/write failures and verify that each migration returns false, logs the correct step, and does not advance its version; alternatively, keep this PR focused on the collation fix. The existing 100% patch gate must pass before approval. The CI unit tests themselves pass; the failure is the subsequent coverage gate.
Each failure path added to includes/schema.php is now driven by a SetupTest data set: the step returns false, logs one line naming the step and reason (with the database error only for storage failures), and does not advance the schema version. A healthy install against the same fake database logs nothing and reaches v14. Changed-line coverage of the PR goes from 11/33 to 32/32.
|
Thanks @somethingwithproof. I extended the existing tests rather than narrowing the PR (9d6378d).
Locally, under Pest with pcov, |
|



The v4 device backfill compared JSON_TYPE() output (server default utf8mb3_uca1400_ai_ci on MariaDB 11.x) with a literal in Cacti's connection collation (utf8mb3_general_ci), failing with error 1267 and leaving the plugin at "Awaiting Configuration". Compare the bytes with CAST(... AS BINARY) instead.
Schema steps also failed silently; every failure path now logs the step, reason and database error to the Cacti log.
Fixes #15