Skip to content

test(Database): fix state leaks and random-order test determinism for MySQLi, PostgreSQL, and OCI8 - #10581

Open
gr8man wants to merge 5 commits into
codeigniter4:developfrom
gr8man:fix-postgres-tests
Open

gr8man wants to merge 5 commits into
codeigniter4:developfrom
gr8man:fix-postgres-tests

Conversation

@gr8man

@gr8man gr8man commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Description
Fixes database tests to be deterministic under random execution order
for MySQLi, PostgreSQL, and OCI8 drivers. Ref: #9968
Ref: #9968
Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@carson-codeigniter4 carson-codeigniter4 Bot added github_actions Pull requests that update Github_actions code needs template Opened issues not following the bug form template labels Sep 23, 2026
@carson-codeigniter4

Copy link
Copy Markdown

Hi there, @gr8man! 👋

It looks like this pull request does not follow our template:

Please update the description to follow the template. The needs template label will be removed automatically once it does.

@carson-codeigniter4 carson-codeigniter4 Bot removed the needs template Opened issues not following the bug form template label Sep 23, 2026
… MySQLi, PostgreSQL, and OCI8

Fixes database tests to be deterministic under random execution order
for MySQLi, PostgreSQL, and OCI8 drivers. Ref codeigniter4#9968.

- Fix random-order test execution issues and state leakage under
  PostgreSQL, MySQL, and OCI8
- Isolate per-component database schemas for parallel random-test runs
- Safely extract dbParams keys with null coalescing in Registrar
- Drop team_members table in migration down method
- Run Oracle components sequentially and exclude Oracle from the random
  test matrix (single shared schema via DSN causes ORA-00955 collisions)
- Handle case-insensitive cached tableExists and catalog lookups in OCI8
- Fix OCI8 insertID() to preserve quoted table name case so Oracle
  USER_TAB_COLUMNS lookups match forge-created (lowercase) tables
@gr8man
gr8man marked this pull request as draft September 26, 2026 19:43
@gr8man
gr8man marked this pull request as ready for review September 26, 2026 21:03
@gr8man

gr8man commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Hey everyone! 👋

I've finished testing and cleaning up the branch. I stripped out all the unnecessary changes (especially the OCI8 experiments and non-essential tweaks in system/).

What remains now is (hopefully!) the bare minimum strictly required to make the database test suite deterministic and green under --order-by=random:

  • Per-component database schema isolation in Registrar (to prevent parallel jobs from stepping on each other)
  • Dropping team_members and migrations_lock during teardowns to avoid state leaks
  • Ensuring custom connection instances in tests don't pollute the shared registry ($getShared = false)
  • A deterministic index selection preference (PRIMARY over UNIQUE) for PostgreSQL upsert()
  • Minor dynamic database name adjustments in tests (UpsertTest, ExecuteLogMessageFormatTest)

All checks are green across the board now. The PR is ready for review! 🚀

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update Github_actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant