Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/node-client-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,35 @@ jobs:
if: needs.detect-changes.outputs.node == 'true' || needs.detect-changes.outputs.node_typeorm == 'true'
runs-on: ubuntu-latest
timeout-minutes: 45
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: node_test
MYSQL_USER: nodeuser
MYSQL_PASSWORD: nodepassword
MYSQL_ROOT_PASSWORD: rootpassword
options: >-
--health-cmd "mysqladmin ping -h localhost -u root -prootpassword"
--health-interval=10s
--health-timeout=5s
--health-retries=5
ports:
- 3306:3306
mariadb:
image: mariadb:10.11
env:
MARIADB_DATABASE: node_test
MARIADB_USER: nodeuser
MARIADB_PASSWORD: nodepassword
MARIADB_ROOT_PASSWORD: rootpassword
options: >-
--health-cmd "mysqladmin ping -h localhost -u root -prootpassword"
--health-interval=10s
--health-timeout=5s
--health-retries=5
ports:
- 3307:3306
steps:
- uses: actions/checkout@v5

Expand Down Expand Up @@ -67,6 +96,8 @@ jobs:
mkdir -p ojp-libs
curl -fsSL https://repo.maven.apache.org/maven2/com/h2database/h2/2.3.232/h2-2.3.232.jar -o ojp-libs/h2.jar
curl -fsSL https://repo.maven.apache.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -o ojp-libs/postgresql.jar
curl -fsSL https://repo.maven.apache.org/maven2/com/mysql/mysql-connector-j/8.4.0/mysql-connector-j-8.4.0.jar -o ojp-libs/mysql-connector-j.jar
curl -fsSL https://repo.maven.apache.org/maven2/org/mariadb/jdbc/mariadb-java-client/3.5.3/mariadb-java-client-3.5.3.jar -o ojp-libs/mariadb-java-client.jar
curl -fsSL https://repo.maven.apache.org/maven2/com/microsoft/sqlserver/mssql-jdbc/12.8.2.jre11/mssql-jdbc-12.8.2.jre11.jar -o ojp-libs/mssql-jdbc.jar

- name: Start databases
Expand Down Expand Up @@ -228,6 +259,8 @@ jobs:
OJP_TEST_H2_ADDR: localhost:1059
OJP_ENABLE_LOB_H2_TESTS: 'true'
OJP_ENABLE_INTEGRATION_TESTS: 'true'
OJP_ENABLE_MYSQL_TESTS: 'true'
OJP_ENABLE_MARIADB_TESTS: 'true'
OJP_ENABLE_POSTGRES_L7_TESTS: 'true'
OJP_ENABLE_POSTGRES_L8_TESTS: 'true'
OJP_ENABLE_POSTGRES_L10_TESTS: 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ These entries describe the levels targeted by the language client modules; they
| C++ ODBC (`ojp-client-cpp-odbc`) | SQL Server | **L10** | SQL Server combined multinode/XA suite runs against two mTLS servers and checks trusted, missing and untrusted client certificates. |
| C++ ODBC (`ojp-client-cpp-odbc`) | PostgreSQL | **L10** | PostgreSQL combined multinode/XA suite runs against two mTLS servers and checks trusted, missing and untrusted client certificates. |
| C++ ODBC (`ojp-client-cpp-odbc`) | MariaDB / MySQL | **L10** | Shared MariaDB combined multinode/XA suite runs every database CSV row against two mTLS servers, including certificate rejection checks. |
| Node.js (`ojp-node-driver`) | MariaDB | **L1** | `test/integration.mariadb.l1.test.ts` exercises parameterized CRUD, SQL errors, empty results, session lifecycle, and scoped-client cleanup against a real MariaDB server. |
| Node.js (`ojp-node-driver`) | MySQL | **L1** | `test/integration.mysql.l1.test.ts` exercises parameterized CRUD, SQL errors, empty results, session lifecycle, and scoped-client cleanup against a real MySQL server. |
| Go (`ojp-client-go-database-sql`) | H2 | **L3** | L1-L3 are covered by `client/h2_l1_integration_test.go`, `client/h2_l2_integration_test.go`, `client/h2_l3_integration_test.go`, and `client/h2_l3_fetch_integration_test.go`. |
| Dart (`ojp-client-dart-drift`) | H2 | **L1** | `test/h2_l1_integration_test.dart` exercises the real-server CRUD and lifecycle path. |
| .NET ADO.NET (`ojp-client-dotnet-ado-net`) | H2 | **L1** | `tests/Ojp.Client.IntegrationTests/H2L1IntegrationTests.cs` exercises the real-server CRUD/lifecycle path using `TestData/h2_l1_connection.csv`. |
Expand All @@ -99,6 +101,8 @@ These levels are based on each language client's own integration tests and are i
| **C++ ODBC** | MariaDB / MySQL | **L10** | `cpp-odbc-mariadb-test` runs L1-L10 for both database CSV rows with required mTLS on both servers, including `mariadb_l10_integration_test.cpp`. |
| **Node.js** | PostgreSQL | **L9** | `ojp-node-driver/test/integration.postgres.l1.test.ts` through `integration.postgres.l8.test.ts` cover CRUD/lifecycle, typed values, transactions/savepoints, result-set pagination, hydrated `BYTEA`/`TEXT` round trips, session affinity, multinode health/recovery, bounded stateless failover and redistribution, safe SQL/transaction/sticky-session error handling, and pool-exhaustion behavior. `ojp-node-driver/test/integration.xa.postgres.test.ts` adds XA commit/rollback/recovery, timeout and resource-manager semantics, and multinode affinity/failover safety. |
| **Node.js** | SQL Server | **L10** | `ojp-node-driver/test/integration.sqlServerL10.test.ts` combines SQL and XA outcomes, stateless failover/recovery, sticky-session and XA affinity failures over two mTLS endpoints, and missing/untrusted certificate rejection. Existing SQL Server suites provide the full L1-L9 cumulative coverage. |
| **Node.js** | MariaDB | **L1** | `ojp-node-driver/test/integration.mariadb.l1.test.ts` covers parameterized CRUD, SQL errors, empty results, session close, fresh-client behavior, and cleanup when scoped callbacks fail. |
| **Node.js** | MySQL | **L1** | `ojp-node-driver/test/integration.mysql.l1.test.ts` covers parameterized CRUD, SQL errors, empty results, session close, fresh-client behavior, and cleanup when scoped callbacks fail. |
| **Go** | H2 | **L3** | L1-L3 real-server integration coverage: `ojp-client-go-database-sql/client/h2_l1_integration_test.go`, `h2_l2_integration_test.go`, `h2_l3_integration_test.go`, and `h2_l3_fetch_integration_test.go`. |
| **Dart** | H2 | **L1** | `ojp-client-dart-drift/test/h2_l1_integration_test.dart` |
| **.NET ADO.NET** | H2 | **L1** | `ojp-client-dotnet-ado-net/tests/Ojp.Client.IntegrationTests/H2L1IntegrationTests.cs` |
Expand Down
38 changes: 24 additions & 14 deletions ojp-node-driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ Level definitions: [`CLIENT_IMPLEMENTATION_LEVELS.md`](../documents/multi-langua
| Assessment | Value |
|---|---|
| Target level | **L10** for PostgreSQL and SQL Server |
| Cumulative level | **L1** for H2; **L10** for PostgreSQL and SQL Server |
| Cumulative level | **L1** for H2, MariaDB, MySQL; **L10** for PostgreSQL and SQL Server |
| Higher-level features | PostgreSQL and SQL Server L10 combine multinode recovery and XA behavior over mTLS |

Levels are cumulative: partial support for a higher level does not make it achieved.
The H2, PostgreSQL, and SQL Server L1 suites exercise CRUD, errors, and session lifecycle
through a real OJP server and database. PostgreSQL L2 coverage is in
The H2, MariaDB, MySQL, PostgreSQL, and SQL Server L1 suites exercise CRUD, errors, and
session lifecycle through a real OJP server and database. MariaDB and MySQL run the same
four L1 scenarios through their public Node API as PostgreSQL, matching the JDBC
`BasicCrudIntegrationTest` and connection lifecycle checks. PostgreSQL L2 coverage is in
`test/integration.postgres.l2.test.ts`; PostgreSQL L3 coverage is in
`test/integration.postgres.l3.test.ts`; and PostgreSQL L4 coverage is in
`test/integration.postgres.l4.test.ts`; PostgreSQL L5 coverage is in
Expand All @@ -28,9 +30,11 @@ failover, recovery and redistribution, and validates sticky-session and pool-exh
failure behavior in `test/integration.postgres.l8.test.ts`. L3 exercises streamed and buffered results across
10,001 rows, paged PostgreSQL `RETURNING` results, metadata, exhaustion, independent
cursors, and early cursor close. L4 covers transaction commit/rollback, autocommit
behavior, isolation levels, savepoints, and transaction-scoped cleanup. The stream and fetch paths carry session state internally.
Callers still manage the client lifetime with `connect()`/`close()`, or use
`withOjpClient()` to scope that lifecycle automatically. PostgreSQL L2 extends L1 with
behavior, isolation levels, savepoints, and transaction-scoped cleanup. The stream and
fetch paths carry session state internally. Callers never manually pass session state:
`OjpClient` propagates it for each operation. Callers can manage the client lifetime with
`connect()`/`close()`, or use `withOjpClient()` to scope that lifecycle automatically.
PostgreSQL L2 extends L1 with
typed values, prepared/plain statements, batches, generated keys, query metadata, and
direct/prepared `RETURNING` DML.
SQL Server L1 passed in the
Expand All @@ -42,7 +46,7 @@ datasource selection using `testdata/h2_connections.csv`.

| Level | Status | Notes |
|---|---|---|
| **L1** | H2, PostgreSQL, SQL Server | `connect`/`close`, CRUD, SQL errors and empty results. PostgreSQL also verifies scoped client cleanup and distinct client instances. See `test/integration.h2.l1.test.ts`, `test/integration.postgres.l1.test.ts`, and `test/integration.sqlServerAg.test.ts`. |
| **L1** | H2, MariaDB, MySQL, PostgreSQL, SQL Server | `connect`/`close`, parameterized CRUD, SQL errors and empty results. MariaDB and MySQL also verify scoped client cleanup, distinct client instances, and cleanup when callbacks fail. See `test/integration.h2.l1.test.ts`, `test/integration.mariadb.l1.test.ts`, `test/integration.mysql.l1.test.ts`, `test/integration.postgres.l1.test.ts`, and `test/integration.sqlServerAg.test.ts`. |
| **L2** | PostgreSQL, SQL Server | PostgreSQL covers typed parameters, reusable prepared bindings, plain/prepared batches, generated keys (including prepared batches), column-label metadata, and `RETURNING` DML. SQL Server adds the equivalent `OUTPUT` result-set path. `ARRAY` and `REF` are explicit, tested API omissions. SQL Server certification passed in run 43528198577. |
| **L3** | PostgreSQL, SQL Server | PostgreSQL covers streamed and buffered 10,001-row results, PostgreSQL `RETURNING` pagination through `fetchNextRows`, metadata, EOF, concurrent cursors, and early cursor close. See `test/integration.postgres.l3.test.ts`. SQL Server covers streaming, pagination, metadata, EOF, concurrent cursors, and early close in `test/integration.sqlServerL3.test.ts`. |
| **L4** | PostgreSQL, SQL Server (certified) | PostgreSQL covers commit/rollback, autocommit behavior, isolation-level get/set, named/unnamed and nested savepoints, rollback-to-savepoint, release, and transaction completion invalidation. See `test/integration.postgres.l4.test.ts`. SQL Server additionally covers batch rollback and error recovery in `test/integration.sqlServerL4.test.ts`. |
Expand All @@ -69,9 +73,9 @@ container configuration. `OjpClient` manages `SessionInfo`, `sessionUUID`, and `
for every operation; `withOjpClient()` and `withTransaction()` also avoid manual
connect/close and transaction-cleanup boilerplate.

The Node integration workflow provisions separate two-node PostgreSQL and SQL Server
OJP clusters that require client certificates and runs both L10 suites alongside their
L1–L9 suites. H2 remains at L1.
The Node integration workflow provisions MySQL and MariaDB, plus separate two-node
PostgreSQL and SQL Server OJP clusters that require client certificates; it runs both L10
suites alongside their L1–L9 suites. H2, MariaDB and MySQL are at L1.

SQL Server's L5 coverage documents that the JDBC driver rejects ranged BLOB/CLOB reads
with “This operation is not supported”; this affects `readLobStream` and transparent
Expand Down Expand Up @@ -701,6 +705,8 @@ npm run build # compiles TypeScript to dist/
npm test # unit tests (parser, type mapping) — no external infrastructure needed
npm run test:integration # integration against ojp-server + PostgreSQL (requires OJP_ENABLE_INTEGRATION_TESTS=true)
npm run test:integration:all # all integration suites; configure all test infrastructure and flags
OJP_ENABLE_MYSQL_TESTS=true npm run test:mysql-l1 # MySQL L1 against a real server
OJP_ENABLE_MARIADB_TESTS=true npm run test:mariadb-l1 # MariaDB L1 against a real server
npm run test:postgres-l8 # PostgreSQL L8 recovery; requires three OJP nodes and a maxConcurrentRequests=1 node
npm run test:postgres-l10 # PostgreSQL L10 combined multinode/mTLS certification
npm run test:lob-h2 # LOB integration against ojp-server + H2 (requires OJP_ENABLE_LOB_H2_TESTS=true)
Expand All @@ -727,10 +733,14 @@ OJP_TEST_H2=true OJP_TEST_H2_ADDR=localhost:1059 npx jest --runInBand test/integ
```

Each suite reads every JDBC URL, username and password row from its CSV fixture.
Override fixture paths with `OJP_TEST_H2_CSV`, `OJP_TEST_POSTGRES_CSV` or
`OJP_TEST_SQLSERVER_CSV`. Set `OJP_TEST_SERVER_ENDPOINT` for PostgreSQL and
SQL Server, and `OJP_TEST_H2_ADDR` for H2. Database passwords can be supplied via
`OJP_TEST_PASSWORD` (PostgreSQL) and `OJP_TEST_SQLSERVER_PASSWORD`.
The Node workflow uses MySQL 8.0 on port 3306 and MariaDB 10.11 on port 3307, with
the OJP server's matching JDBC drivers. Override fixture paths with
`OJP_TEST_H2_CSV`, `OJP_TEST_MYSQL_CSV`,
`OJP_TEST_MARIADB_CSV`, `OJP_TEST_POSTGRES_CSV` or `OJP_TEST_SQLSERVER_CSV`. Set
`OJP_TEST_SERVER_ENDPOINT` for MariaDB, MySQL, PostgreSQL and SQL Server, and
`OJP_TEST_H2_ADDR` for H2. Database passwords can be supplied via
`OJP_TEST_MYSQL_PASSWORD`, `OJP_TEST_MARIADB_PASSWORD`, `OJP_TEST_PASSWORD` (PostgreSQL)
and `OJP_TEST_SQLSERVER_PASSWORD`.

```bash
cd ../ojp-server
Expand Down
2 changes: 2 additions & 0 deletions ojp-node-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"test": "jest --testPathIgnorePatterns=integration",
"test:integration:all": "jest --runInBand test/integration",
"test:integration": "jest test/integration.ojpServer.test.ts",
"test:mysql-l1": "jest --runInBand test/integration.mysql.l1.test.ts",
"test:mariadb-l1": "jest --runInBand test/integration.mariadb.l1.test.ts",
"test:postgres-l1": "jest --runInBand test/integration.postgres.l1.test.ts",
"test:postgres-l2": "jest --runInBand test/integration.postgres.l2.test.ts",
"test:postgres-l3": "jest --runInBand test/integration.postgres.l3.test.ts",
Expand Down
9 changes: 9 additions & 0 deletions ojp-node-driver/test/integration.mariadb.l1.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { registerDatabaseL1Suite } from './mysqlMariaDbL1Suite';

registerDatabaseL1Suite({
database: 'MariaDB',
enabledEnvironmentVariable: 'OJP_ENABLE_MARIADB_TESTS',
fixture: 'mariadb_connections.csv',
fixtureEnvironmentVariable: 'OJP_TEST_MARIADB_CSV',
passwordEnvironmentVariable: 'OJP_TEST_MARIADB_PASSWORD',
});
9 changes: 9 additions & 0 deletions ojp-node-driver/test/integration.mysql.l1.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { registerDatabaseL1Suite } from './mysqlMariaDbL1Suite';

registerDatabaseL1Suite({
database: 'MySQL',
enabledEnvironmentVariable: 'OJP_ENABLE_MYSQL_TESTS',
fixture: 'mysql_connections.csv',
fixtureEnvironmentVariable: 'OJP_TEST_MYSQL_CSV',
passwordEnvironmentVariable: 'OJP_TEST_MYSQL_PASSWORD',
});
Loading
Loading