-
-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improvements to allow to use Bun and tls (#2119)
* uplift startTls code to be compatible with current bun * more tls refactoring * lint * ci: enable tls in bun matrix * fix ssl tests * lint * bun: only run 2 basic tests for now * lint * don't enable ssl in test running against fake server * fix typo * debug failures * try bun canary * ci: add osx runner * ci: install docker for osx * ci: install docker for osx * ci: install docker for osx * ci: osx - don't mount config in docker * handle ECONNREFUSED in waitDatabaseReady helper * comment out instead of early return * explicitly install lima * use connection.end() instead of destroy * debug Ssl_cipher assertion * more flexible Ssl_cipher assertion * initialize packet header befor writing * cleanup * add compression to bun matrix * only use bun v0.6.13 for non-ssl tests
- Loading branch information
Showing
12 changed files
with
171 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: CI - OSX | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [ main ] | ||
|
||
workflow_dispatch: | ||
|
||
env: | ||
MYSQL_PORT: 3306 | ||
MYSQL_USER: root | ||
MYSQL_DATABASE: test | ||
|
||
jobs: | ||
tests-osx: | ||
runs-on: macos-13 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
mysql-version: ["mysql:8.0.22", "mysql:8.0.33"] | ||
use-compression: [0, 1] | ||
use-tls: [0] | ||
mysql_connection_url_key: [""] | ||
# TODO - add mariadb to the matrix. currently few tests are broken due to mariadb incompatibilities | ||
include: | ||
# 20.x | ||
- node-version: "20.x" | ||
mysql-version: "mysql:8.0.33" | ||
use-compression: 1 | ||
use-tls: 0 | ||
use-builtin-test-runner: 1 | ||
- node-version: "20.x" | ||
mysql-version: "mysql:8.0.33" | ||
use-compression: 0 | ||
use-tls: 1 | ||
use-builtin-test-runner: 1 | ||
env: | ||
MYSQL_CONNECTION_URL: ${{ secrets[matrix.mysql_connection_url_key] }} | ||
|
||
name: Node.js ${{ matrix.node-version }} - DB ${{ matrix.mysql-version }}${{ matrix.mysql_connection_url_key }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: install lima | ||
run: brew install lima | ||
|
||
- name: Setup Docker on macOS | ||
uses: douglascamata/setup-docker-macos-action@v1-alpha | ||
|
||
- name: Set up MySQL | ||
if: ${{ matrix.mysql-version }} | ||
run: docker run -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=${{ env.MYSQL_DATABASE }} -p ${{ env.MYSQL_PORT }}:3306 ${{ matrix.mysql-version }} | ||
|
||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('package-lock.json') }} | ||
restore-keys: npm- | ||
|
||
- name: Install npm dependencies | ||
run: npm ci | ||
|
||
- name: Wait mysql server is ready | ||
if: ${{ matrix.mysql-version }} | ||
run: node tools/wait-up.js | ||
|
||
- name: Run tests | ||
run: FILTER=${{matrix.filter}} MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} npm run coverage-test | ||
|
||
- name: Run tests with built-in node test runner | ||
if: ${{ matrix.use-builtin-test-runner }} | ||
run: FILTER=${{matrix.filter}} MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} npm run test:builtin-node-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const common = require('../../common'); | ||
const connection = common.createConnection(); | ||
|
||
connection.query(`SHOW STATUS LIKE 'Ssl_cipher'`, (err, rows) => { | ||
assert.ifError(err); | ||
if (process.env.MYSQL_USE_TLS === '1') { | ||
assert.equal(rows[0].Value.length > 0, true); | ||
} else { | ||
assert.deepEqual(rows, [{ Variable_name: 'Ssl_cipher', Value: '' }]); | ||
} | ||
connection.end(); | ||
}); |
Oops, something went wrong.