Skip to content

[ORM] 跨后端测试与 CI #93

Done

Description

@Antruly

父任务:#88

目标

把 ORM 的正确性、兼容性和回归门禁钉死。性能单独由“数据库与 ORM 性能基准”issue 负责,本 issue 负责功能正确性和跨平台/跨后端覆盖。

交付物

  • tests/functional/orm_suite.h
    • 与现有 db_suite.h 同型:一份断言,SQLite / MySQL / PostgreSQL / ODBC 各跑一遍
    • 方言差异只放在 dialect 虚函数里;出现 if (backend == ...) 要说明原因
    • 失败 / 通过 / 不适用三种计数分开,跳过必须打印
  • 新用例
    • 模型元数据、SQL golden、CRUD、NULL/空串、类型边界、BLOB、日期时间
    • 事务提交/回滚/异常/超时
    • 异步回调次数、线程、投递失败、连接断开
    • SQL 注入语料(值、标识符、LIKE 通配符、引号、注释、分号)
    • 并发池:多读、单写、事务冲突、连接归还
    • 映射错误:缺列、多列、类型不匹配、非空列为 NULL
  • CI 配置
    • Linux GCC:DB ON + ORM ON;SQLite/MySQL/PostgreSQL/ODBC SQLite
    • Windows MSVC 与 MinGW:至少 ORM 头文件编译 + SQLite 用例
    • macOS:至少编译 + SQLite
    • DB OFF + ORM OFF:既有构建不退化
    • C++11 编译检查;C ABI 符号锁不变
    • 可选 ASan/UBSan 任务,发现内存/生命周期问题
  • 失败注入
    • 查询中 kill 连接、服务端返回错误、事务超时、池耗尽、回调投递失败

验收标准

  • SQLite 全量通过;MySQL/PostgreSQL 真库全量通过;ODBC 到 SQLite 通过
  • 不适用项逐条打印,不能把跳过写成通过
  • Windows/macOS 至少编译通过,SQLite 用例有实际运行记录
  • DB OFF 时 ORM 不参与构建;既有测试零回归
  • 公开头可被外部工程包含,不依赖测试夹具
  • 测试运行时间可控;慢用例标记并在 CI 中分离,不能靠无限重试变绿

依赖

明确不做

  • 用 mock 替代真库来声称跨后端通过
  • 在共享 CI 上把性能抖动当功能失败(性能有独立门禁)
  • 代码生成、迁移、关联测试

PR 要求

  • 分支:test/orm-conformance
  • 标题:test(orm): add cross-backend conformance and CI lanes
  • PR 附每个后端的命令、原始输出、跳过项清单
  • 至少一位维护者 review;CI 全绿后合并

Activity

  1. added this to the 1.12.0 milestone on Nov 27, 2026
  2. added
    enhancement
    on Nov 27, 2026
  3. Antruly commented on Nov 27, 2026

    @Antruly
    OwnerAuthor

    PR #99 merged the phase-1 ORM model/CI gates plus the extension point for future orm_* tests. This issue remains open for the SQL/CRUD-backed cross-backend coverage (MySQL/PostgreSQL/ODBC), full migration/transaction matrix and Windows/macOS runtime results after #92.

  4. Antruly commented on Nov 27, 2026

    @Antruly
    OwnerAuthor

    Current environment check: MySQL client headers (mysql.h) are absent, PostgreSQL has libpq-fe.h but no server binaries/cluster, and no test credentials are available. SQLite ORM CRUD/transaction/async coverage is green; real MySQL/PostgreSQL/ODBC ORM coverage cannot be honestly marked complete here. Need a server/credentials or a CI runner with the backends enabled.

  5. Antruly commented on Nov 27, 2026

    @Antruly
    OwnerAuthor

    PRs #106 and #107 now run the ORM synchronous CRUD test against real MySQL 8.0.46 and PostgreSQL 16.15 (24 checks each), and the Ubuntu db-servers job runs both. A local full tree with SQLite + MySQL + PostgreSQL + ORM passed ctest 80/80. Remaining in this issue: ORM transactions/async on MySQL/PostgreSQL, ODBC ORM, and the real GitHub Actions run.

  6. Antruly commented on Nov 27, 2026

    @Antruly
    OwnerAuthor

    Coverage now includes real MySQL 8.0.46, PostgreSQL 16.15 and ODBC(SQLite) synchronous CRUD + transaction commit/rollback, plus callback async CRUD on all three (22 checks each). Full local tree with SQLite+MySQL+PostgreSQL+ODBC+ORM: ctest 83/83. ODBC auto-increment and the fixed-runner/failure-injection/Windows-macOS CI gates remain open.

  7. Antruly commented on Nov 27, 2026

    @Antruly
    OwnerAuthor

    Remaining ODBC gaps closed locally: ORM ODBC now runs against both libsqlite3odbc and psqlODBC (PostgreSQL 16), covers last_insert_rowid() / lastval() auto-increment, explicit-key CRUD, transactions and duplicate-key errors (38 checks). Async pool-exhaustion callback is covered on MySQL and ODBC; PostgreSQL native async does not surface the acquire timeout through the callback and is documented rather than masked. Still open: SQL Server/Oracle ODBC, connection-kill/isolation/timeout injection per ORM backend, and Windows/macOS real runs.

  8. Antruly commented on Nov 27, 2026

    @Antruly
    OwnerAuthor

    Latest local closure: ODBC auto-increment works for both libsqlite3odbc (last_insert_rowid) and psqlodbc (lastval), with 38/38 checks each; db ODBC suite is 188 passed / 0 failed / 3 N/A. Async pool exhaustion is covered on MySQL/ODBC (PostgreSQL native path documented as not surfacing the acquire timeout). Full tree at master 5e29711: ctest 83/83. Remaining are non-local gates only: SQL Server/Oracle ODBC, connection-kill/isolation/timeout beyond the db suite, Windows/macOS runner execution.

  9. Antruly commented on Nov 27, 2026

    @Antruly
    OwnerAuthor

    Closing as delivered for v1.12.0: SQLite/MySQL/PostgreSQL/ODBC(SQLite + psqlODBC) ORM CRUD, transactions, auto-increment and remote async coverage; Windows MSVC ORM 75/75 and MinGW green; Linux/macOS CI green; full local ctest 83/83. SQL Server/Oracle ODBC and deeper connection-kill/isolation injection remain documented limitations in RELEASE.md, not claims of this version.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions