From c5d273a09119049075f7f83624f59f71e3ddc2ca Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Tue, 18 Mar 2025 16:00:38 -0700 Subject: [PATCH 1/6] test(aws-sdk): remove runs for Node.js <18.x --- .../.tav.yml | 55 +++---------------- 1 file changed, 8 insertions(+), 47 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml index 48fcc20f58..cab9755ff4 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml @@ -1,67 +1,28 @@ # Note: tests must set `SKIP_TEST_IF_DISABLE=true` to override usage of # `mocha --require '../../../scripts/skip-test-if.js' ...` if calling `npm test`. -# Versions [3.363.0, 3.377.0] of all @aws-sdk/client-* were bad releases. See: -# - https://github.com/open-telemetry/opentelemetry-js-contrib/pull/2464#issuecomment-2403652552 -# - https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1828#issuecomment-1834276719 - # node version support in JS SDK v3: -# - 14.x dropped in v3.567.0 https://github.com/aws/aws-sdk-js-v3/pull/6034 # - 16.x dropped in v3.723.0 https://github.com/aws/aws-sdk-js-v3/pull/6775 -"@aws-sdk/client-s3": +'@aws-sdk/client-s3': env: - SKIP_TEST_IF_DISABLE=true - # - 3.529.0 was missing the fast-xml-parser dependency (https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.529.1) jobs: - - node: ">=18" - versions: - include: "^3.6.1" - exclude: "3.529.0 || >=3.363.0 <=3.377.0" - mode: "max-7" - commands: - - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-s3.test.ts - - mocha --require '@opentelemetry/contrib-test-utils' test/s3.test.ts - - node: "16" - versions: - include: ">=3.6.1 <3.723.0" - exclude: "3.529.0 || >=3.363.0 <=3.377.0" - mode: "max-7" - commands: - - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-s3.test.ts - - mocha --require '@opentelemetry/contrib-test-utils' test/s3.test.ts - - node: "14" + - node: '>=18' versions: - include: ">=3.6.1 <3.567.0" - exclude: "3.529.0 || >=3.363.0 <=3.377.0" - mode: "max-7" + include: '>=v3.723.0' + mode: 'max-7' commands: - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-s3.test.ts - mocha --require '@opentelemetry/contrib-test-utils' test/s3.test.ts -"@aws-sdk/client-sqs": +'@aws-sdk/client-sqs': env: - SKIP_TEST_IF_DISABLE=true jobs: - - node: ">=18" - versions: - include: "^3.24.0" - exclude: ">=3.363.0 <=3.377.0" - mode: "max-7" - commands: - - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-sqs.test.ts - - node: "16" + - node: '>=18' versions: - include: ">=3.24.0 <3.723.0" - exclude: ">=3.363.0 <=3.377.0" - mode: "max-7" + include: '>=v3.723.0' + mode: 'max-7' commands: - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-sqs.test.ts - - node: "14" - versions: - include: ">=3.24.0 <3.567.0" - exclude: ">=3.363.0 <=3.377.0" - mode: "max-7" - commands: - - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-sqs.test.ts - From 8f4c9ac44a0f23854582886719dfaf10ef7132e8 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Tue, 18 Mar 2025 16:21:04 -0700 Subject: [PATCH 2/6] test(aws-sdk): remove SKIP_TEST_IF_DISABLE=true --- .../node/opentelemetry-instrumentation-aws-sdk/.tav.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml index cab9755ff4..6d6dcea61b 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml @@ -1,12 +1,7 @@ -# Note: tests must set `SKIP_TEST_IF_DISABLE=true` to override usage of -# `mocha --require '../../../scripts/skip-test-if.js' ...` if calling `npm test`. - # node version support in JS SDK v3: # - 16.x dropped in v3.723.0 https://github.com/aws/aws-sdk-js-v3/pull/6775 '@aws-sdk/client-s3': - env: - - SKIP_TEST_IF_DISABLE=true jobs: - node: '>=18' versions: @@ -17,8 +12,6 @@ - mocha --require '@opentelemetry/contrib-test-utils' test/s3.test.ts '@aws-sdk/client-sqs': - env: - - SKIP_TEST_IF_DISABLE=true jobs: - node: '>=18' versions: From bd833d9c956b769e1477ecf2c17616529256ade5 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Tue, 18 Mar 2025 18:07:36 -0700 Subject: [PATCH 3/6] test(aws-sdk): re-introduce checks for past versions --- .../opentelemetry-instrumentation-aws-sdk/.tav.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml index 6d6dcea61b..b1f3559732 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/.tav.yml @@ -1,11 +1,17 @@ +# Versions [3.363.0, 3.377.0] of all @aws-sdk/client-* were bad releases. See: +# - https://github.com/open-telemetry/opentelemetry-js-contrib/pull/2464#issuecomment-2403652552 +# - https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1828#issuecomment-1834276719 + # node version support in JS SDK v3: # - 16.x dropped in v3.723.0 https://github.com/aws/aws-sdk-js-v3/pull/6775 '@aws-sdk/client-s3': + # - 3.529.0 was missing the fast-xml-parser dependency (https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.529.1) jobs: - node: '>=18' versions: - include: '>=v3.723.0' + include: '^3.6.1' + exclude: '3.529.0 || >=3.363.0 <=3.377.0' mode: 'max-7' commands: - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-s3.test.ts @@ -15,7 +21,8 @@ jobs: - node: '>=18' versions: - include: '>=v3.723.0' + include: '^3.24.0' + exclude: '>=3.363.0 <=3.377.0' mode: 'max-7' commands: - mocha --require '@opentelemetry/contrib-test-utils' test/aws-sdk-v3-sqs.test.ts From d74afe7c2896a3110303e368d33176ead8ad5e50 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Tue, 18 Mar 2025 19:57:17 -0700 Subject: [PATCH 4/6] test(aws-sdk): remove SKIP_TEST_IF_NODE_OLDER_THAN --- plugins/node/opentelemetry-instrumentation-aws-sdk/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json index ba5f9fef09..684b61054c 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json @@ -35,7 +35,7 @@ "prewatch": "npm run precompile", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "SKIP_TEST_IF_NODE_OLDER_THAN=18 nyc mocha --require '../../../scripts/skip-test-if.js' --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "version:update": "node ../../../scripts/version-update.js", "watch": "tsc -w" From 9c21f06ab0834ad3fe4f771deebc4a6b64316d99 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Tue, 18 Mar 2025 20:12:01 -0700 Subject: [PATCH 5/6] chore: remove skip-test-if --- scripts/skip-test-if.js | 56 ----------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 scripts/skip-test-if.js diff --git a/scripts/skip-test-if.js b/scripts/skip-test-if.js deleted file mode 100644 index 96be8c483e..0000000000 --- a/scripts/skip-test-if.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * This script can be used with `mocha --require ...` to support skipping - * tests if the current version of Node.js is too old. For example, say - * a package's unit tests cannot run with Node.js 14, but the CI unit tests - * run all package test with that version. - * - * 1. Change this in "package.json": - * "test": "nyc mocha ...", - * to this: - * "test": "SKIP_TEST_IF_NODE_OLDER_THAN=18 nyc mocha --require '../../../scripts/skip-test-if.js' ... ", - * where `SKIP_TEST_IF_NODE_OLDER_THAN` indicates the minimum Node.js major - * version. - * - * 2. ".tav.yml" blocks should set SKIP_TEST_IF_DISABLE=true to - * disable the skipping. Via this in each test block: - * env: - * - SKIP_TEST_IF_DISABLE=true - */ - -function skipTestIf() { - if (process.env.SKIP_TEST_IF_DISABLE) { - return; - } - - const minNodeMajor = process.env.SKIP_TEST_IF_NODE_OLDER_THAN ?? Number(process.env.SKIP_TEST_IF_NODE_OLDER_THAN); - if (!minNodeMajor || isNaN(minNodeMajor)) { - console.warn('skip-test-if warning: set a minimum Node.js major version via SKIP_TEST_IF_NODE_OLDER_THAN='); - return; - } - - const nodeMajor = Number(process.versions.node.split('.')[0]); - if (nodeMajor < minNodeMajor) { - process.stderr.write(`skip-test-if: skipping tests on old Node.js (${nodeMajor} < ${minNodeMajor})\n`); - // "Skip" tests by exiting the process. Mocha is all in one process. - process.exit(0); - } -} - -skipTestIf() - From 0c47546e6ba40ccdcbe85bf5dc87e5616f71d23a Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Wed, 19 Mar 2025 08:43:40 -0700 Subject: [PATCH 6/6] chore: re-add skip-test-if This reverts commit 9c21f06ab0834ad3fe4f771deebc4a6b64316d99. --- scripts/skip-test-if.js | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 scripts/skip-test-if.js diff --git a/scripts/skip-test-if.js b/scripts/skip-test-if.js new file mode 100644 index 0000000000..96be8c483e --- /dev/null +++ b/scripts/skip-test-if.js @@ -0,0 +1,56 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This script can be used with `mocha --require ...` to support skipping + * tests if the current version of Node.js is too old. For example, say + * a package's unit tests cannot run with Node.js 14, but the CI unit tests + * run all package test with that version. + * + * 1. Change this in "package.json": + * "test": "nyc mocha ...", + * to this: + * "test": "SKIP_TEST_IF_NODE_OLDER_THAN=18 nyc mocha --require '../../../scripts/skip-test-if.js' ... ", + * where `SKIP_TEST_IF_NODE_OLDER_THAN` indicates the minimum Node.js major + * version. + * + * 2. ".tav.yml" blocks should set SKIP_TEST_IF_DISABLE=true to + * disable the skipping. Via this in each test block: + * env: + * - SKIP_TEST_IF_DISABLE=true + */ + +function skipTestIf() { + if (process.env.SKIP_TEST_IF_DISABLE) { + return; + } + + const minNodeMajor = process.env.SKIP_TEST_IF_NODE_OLDER_THAN ?? Number(process.env.SKIP_TEST_IF_NODE_OLDER_THAN); + if (!minNodeMajor || isNaN(minNodeMajor)) { + console.warn('skip-test-if warning: set a minimum Node.js major version via SKIP_TEST_IF_NODE_OLDER_THAN='); + return; + } + + const nodeMajor = Number(process.versions.node.split('.')[0]); + if (nodeMajor < minNodeMajor) { + process.stderr.write(`skip-test-if: skipping tests on old Node.js (${nodeMajor} < ${minNodeMajor})\n`); + // "Skip" tests by exiting the process. Mocha is all in one process. + process.exit(0); + } +} + +skipTestIf() +