From f640b1d948a8219dc7a5e58f0ee22a6d54fb7e88 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 25 Jul 2024 08:29:18 -0700 Subject: [PATCH] test: modernize our mssql/server Docker image usage - move to the latest CU (cumulative update) of SQLServer 2022 (which involves updating the healthcheck for internal changes) - use MSSQL_SA_PASSWORD rather than the long since deprecated SA_PASSWORD Refs: https://github.com/elastic/apm-agent-nodejs/issues/4147 --- .ci/docker/docker-compose.yml | 12 ++++++------ .github/workflows/test.yml | 2 +- examples/trace-tedious.js | 2 +- test/docker-compose.yml | 12 ++++++------ test/instrumentation/modules/tedious.test.js | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.ci/docker/docker-compose.yml b/.ci/docker/docker-compose.yml index 4ecdf630d4..b34f484cf9 100644 --- a/.ci/docker/docker-compose.yml +++ b/.ci/docker/docker-compose.yml @@ -31,21 +31,21 @@ services: retries: 30 mssql: - # Cumulative update 14 (CU14), released 2024-07-23, breaks the healthcheck. - # See https://github.com/elastic/apm-agent-nodejs/issues/4147 - image: mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04 + # Tags listed at https://hub.docker.com/r/microsoft/mssql-server + # Docs: https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker + image: mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04 platform: linux/amd64 environment: - ACCEPT_EULA=Y - - SA_PASSWORD=Very(!)Secure + - MSSQL_SA_PASSWORD=Very(!)Secure - MSSQL_PID=Developer ports: - "1433:1433" volumes: - nodemssqldata:/var/opt/mssql healthcheck: - test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "mssql", "-U", "sa", "-P", "Very(!)Secure", "-Q", "select 1"] - interval: 30s + test: ["CMD", "/opt/mssql-tools18/bin/sqlcmd", "-C", "-S", "mssql", "-U", "sa", "-P", "Very(!)Secure", "-Q", "select 1"] + interval: 10s timeout: 10s retries: 5 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac1f91bda1..bf2748b37d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -96,7 +96,7 @@ jobs: image: mcr.microsoft.com/mssql/server env: ACCEPT_EULA: 'Y' - SA_PASSWORD: 'Very(!)Secure' + MSSQL_SA_PASSWORD: 'Very(!)Secure' MSSQL_PID: 'Developer' ports: - 1433:1433 diff --git a/examples/trace-tedious.js b/examples/trace-tedious.js index 5324220d37..78b6e44e96 100755 --- a/examples/trace-tedious.js +++ b/examples/trace-tedious.js @@ -20,7 +20,7 @@ const apm = require('../').start({ const tedious = require('tedious'); const host = process.env.MSSQL_HOST || 'localhost'; -const passwd = process.env.SA_PASSWORD || 'Very(!)Secure'; +const passwd = process.env.MSSQL_SA_PASSWORD || 'Very(!)Secure'; const connOpts = { server: host, authentication: { diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 5ee22bc6f7..bb1d2380f4 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -31,21 +31,21 @@ services: retries: 30 mssql: - # Cumulative update 14 (CU14), released 2024-07-23, breaks the healthcheck. - # See https://github.com/elastic/apm-agent-nodejs/issues/4147 - image: mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04 + # Tags listed at https://hub.docker.com/r/microsoft/mssql-server + # Docs: https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker + image: mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04 platform: linux/amd64 environment: - ACCEPT_EULA=Y - - SA_PASSWORD=Very(!)Secure + - MSSQL_SA_PASSWORD=Very(!)Secure - MSSQL_PID=Developer ports: - "1433:1433" volumes: - nodemssqldata:/var/opt/mssql healthcheck: - test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "mssql", "-U", "sa", "-P", "Very(!)Secure", "-Q", "select 1"] - interval: 30s + test: ["CMD", "/opt/mssql-tools18/bin/sqlcmd", "-C", "-S", "mssql", "-U", "sa", "-P", "Very(!)Secure", "-Q", "select 1"] + interval: 10s timeout: 10s retries: 5 diff --git a/test/instrumentation/modules/tedious.test.js b/test/instrumentation/modules/tedious.test.js index 86fc1aba0d..174d0ba838 100644 --- a/test/instrumentation/modules/tedious.test.js +++ b/test/instrumentation/modules/tedious.test.js @@ -51,7 +51,7 @@ if (semver.gte(version, '4.0.0')) { type: 'default', options: { userName: 'SA', - password: process.env.SA_PASSWORD || 'Very(!)Secure', + password: process.env.MSSQL_SA_PASSWORD || 'Very(!)Secure', }, }, options: { @@ -65,7 +65,7 @@ if (semver.gte(version, '4.0.0')) { connOpts = { server: hostname, userName: 'SA', - password: process.env.SA_PASSWORD || 'Very(!)Secure', + password: process.env.MSSQL_SA_PASSWORD || 'Very(!)Secure', }; }