The GitHub Actions job "Required Checks" on texera.git/main has failed.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
83df2b5132d3b9ab76f8796c890a0685edd9f1fd / Xinyuan Lin <[email protected]>
test(workflow-operator): add unit test coverage for PostgreSQLConnUtil and 
MySQLConnUtil (#5698)

### What changes were proposed in this PR?

Pin the JDBC URL composition for the two SQL-source connection helpers
in `common/workflow-operator/operator/source/sql/{postgresql,mysql}/`
without standing up a real DB. No production-code changes.

| Spec | Source class | Tests |
| --- | --- | --- |
| `PostgreSQLConnUtilSpec` | `PostgreSQLConnUtil` | 8 |
| `MySQLConnUtilSpec` | `MySQLConnUtil` | 10 |

Both spec files follow the `<srcClassName>Spec.scala` one-to-one
convention.

**Behavior pinned — `PostgreSQLConnUtil`**

| Surface | Contract |
| --- | --- |
| URL format | `jdbc:postgresql://{host}:{port}/{database}` (exact
substring) |
| Host/port/database interpolation | distinct values reach their slots;
host BEFORE port |
| Subprotocol | `jdbc:postgresql:`, never `jdbc:mysql:` |
| Empty database name | produces a well-formed
`jdbc:postgresql://{host}:{port}/` URL |
| Credentials | `user` / `password` reach the driver via `Properties` |
| `setReadOnly(true)` | called on the returned Connection
(query-efficiency contract) |
| `SQLException` | propagated when the driver throws |

**Behavior pinned — `MySQLConnUtil`**

| Surface | Contract |
| --- | --- |
| URL format | `jdbc:mysql://{host}:{port}/{database}?…` (exact
substring) |
| Host/port/database interpolation | distinct values reach their slots;
host BEFORE port |
| `autoReconnect=true` query parameter | present (retry-behavior
contract) |
| `useSSL=true` query parameter | present (TLS contract — drift here
would silently downgrade security) |
| `?` / `&` separators | canonical
`jdbc:mysql://h:3306/db?autoReconnect=true&useSSL=true` sequence pinned
end-to-end |
| Subprotocol | `jdbc:mysql:`, never `jdbc:postgresql:` |
| Credentials | `user` / `password` reach the driver via `Properties` |
| `setReadOnly(true)` | called on the returned Connection
(query-efficiency contract) |
| `SQLException` | propagated when the driver throws |

**Test strategy**

Both specs use the same capturing-driver pattern:

- Deregister every driver that claims the relevant `jdbc:postgresql:` /
`jdbc:mysql:` scheme via a `safeAcceptsURL` helper (the JDBC spec allows
`Driver.acceptsURL` to throw `SQLException`, so the probe must be
defensive).
- Register a capturing driver that records each URL + the `Properties`
it is asked to open, and returns a `java.lang.reflect.Proxy`-backed
`Connection` so the production code can call `setReadOnly(true)` against
a stand-in.
- Restore the original drivers in `afterAll`. Setup failures also
trigger best-effort re-registration so a sibling suite never sees a
half-deregistered JDBC registry.

This approach works regardless of whether a real driver happens to be on
the test classpath (the PostgreSQL driver is loaded transitively from
`org.postgresql:postgresql`; the MySQL driver is not currently on the
workflow-operator classpath, but the spec is robust if it gets added
later).

### Any related issues, documentation, discussions?

Closes #5695.

### How was this PR tested?

Pure unit-test additions; verified locally with:

- \`sbt \"WorkflowOperator/testOnly
org.apache.texera.amber.operator.source.sql.postgresql.PostgreSQLConnUtilSpec
org.apache.texera.amber.operator.source.sql.mysql.MySQLConnUtilSpec\"\`
— 18 tests, all green
- \`sbt scalafmtCheckAll\` — clean
- CI to confirm

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7 [1M context])

Report URL: https://github.com/apache/texera/actions/runs/27522840785

With regards,
GitHub Actions via GitBox

Reply via email to