From 36d3f8ab12422ff8014e9d0e1beda44faed83016 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 11:26:35 -0400 Subject: [PATCH 01/12] add linked version of sandbox --- integration-tests/helpers/index.js | 34 ++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/integration-tests/helpers/index.js b/integration-tests/helpers/index.js index fd54267a105..b95f36c5f86 100644 --- a/integration-tests/helpers/index.js +++ b/integration-tests/helpers/index.js @@ -236,15 +236,23 @@ function execHelper (command, options) { /* eslint-enable no-console */ } +async function isolatedSandbox (dependencies, isGitRepo, integrationTestsPaths, followUpCommand) { + return createSandbox(dependencies, isGitRepo, integrationTestsPaths, followUpCommand, true) +} + +async function linkedSandbox (dependencies, isGitRepo, integrationTestsPaths, followUpCommand) { + return createSandbox(dependencies, isGitRepo, integrationTestsPaths, followUpCommand, false) +} + /** * @param {string[]} dependencies * @param {boolean} isGitRepo * @param {string[]} integrationTestsPaths * @param {string} [followUpCommand] + * @param {string} [isolated=true] */ - async function createSandbox (dependencies = [], isGitRepo = false, - integrationTestsPaths = ['./integration-tests/*'], followUpCommand) { + integrationTestsPaths = ['./integration-tests/*'], followUpCommand, isolated = true) { const cappedDependencies = dependencies.map(dep => { if (builtinModules.includes(dep)) return dep @@ -271,15 +279,25 @@ async function createSandbox (dependencies = [], isGitRepo = false, } const folder = path.join(os.tmpdir(), id().toString()) const out = path.join(folder, `dd-trace-${version}.tgz`) - const allDependencies = [`file:${out}`].concat(cappedDependencies) + const deps = cappedDependencies.join(' ') await fs.mkdir(folder) - const preferOfflineFlag = process.env.OFFLINE === '1' || process.env.OFFLINE === 'true' ? ' --prefer-offline' : '' - const addCommand = `yarn add ${allDependencies.join(' ')} --ignore-engines${preferOfflineFlag}` const addOptions = { cwd: folder, env: restOfEnv } - execHelper(`npm pack --silent --pack-destination ${folder}`, { env: restOfEnv }) // TODO: cache this + const addFlags = ['--ignore-engines'] - execHelper(addCommand, addOptions) + if (process.env.OFFLINE === '1' || process.env.OFFLINE === 'true') { + addFlags.push('--prefer-offline') + } + + if (isolated) { + execHelper(`npm pack --silent --pack-destination ${folder}`, { env: restOfEnv }) + execHelper(`yarn add ${deps} file:${out}`, addOptions) + } else { + [`file:${out}`].concat(cappedDependencies) + execHelper('yarn link') + execHelper(`yarn add ${deps}`, addOptions) + execHelper('yarn link dd-trace', addOptions) + } for (const path of integrationTestsPaths) { if (process.platform === 'win32') { @@ -667,6 +685,8 @@ module.exports = { getCiVisAgentlessConfig, getCiVisEvpProxyConfig, checkSpansForServiceName, + isolatedSandbox, + linkedSandbox, spawnPluginIntegrationTestProc, useEnv, useSandbox, From fceece7bb865d5f4813c6f826e9ac450e2603a97 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 11:28:01 -0400 Subject: [PATCH 02/12] switch to linked sandbox for plugin tests --- .../datadog-plugin-ai/test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/eventhubs-test/eventhubs.spec.js | 4 ++-- .../test/integration-test/http-test/client.spec.js | 4 ++-- .../integration-test/servicebus-test/servicebus.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../datadog-plugin-dns/test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- packages/datadog-plugin-graphql/test/esm-test/esm.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../datadog-plugin-koa/test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 6 +++--- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../datadog-plugin-net/test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../datadog-plugin-pg/test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- .../test/integration-test/client.spec.js | 4 ++-- 59 files changed, 119 insertions(+), 119 deletions(-) diff --git a/packages/datadog-plugin-ai/test/integration-test/client.spec.js b/packages/datadog-plugin-ai/test/integration-test/client.spec.js index b1874a9c077..defeac16b61 100644 --- a/packages/datadog-plugin-ai/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-ai/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') const { assert } = require('chai') @@ -24,7 +24,7 @@ describe('esm', () => { withVersions('ai', 'ai', (version, _, realVersion) => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([ + sandbox = await linkedSandbox([ `ai@${version}`, `@ai-sdk/openai@${getOpenaiVersion(realVersion)}`, 'zod@3.25.75' diff --git a/packages/datadog-plugin-amqp10/test/integration-test/client.spec.js b/packages/datadog-plugin-amqp10/test/integration-test/client.spec.js index 380deedc44b..155cf797d00 100644 --- a/packages/datadog-plugin-amqp10/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-amqp10/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -16,7 +16,7 @@ describe('esm', () => { withVersions('amqp10', 'amqp10', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'amqp10@${version}'`, 'rhea'], false, [ + sandbox = await linkedSandbox([`'amqp10@${version}'`, 'rhea'], false, [ './packages/datadog-plugin-amqp10/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-amqplib/test/integration-test/client.spec.js b/packages/datadog-plugin-amqplib/test/integration-test/client.spec.js index 940a1d8e61e..93e6cfaa10b 100644 --- a/packages/datadog-plugin-amqplib/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-amqplib/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -20,7 +20,7 @@ describe('esm', () => { withVersions('amqplib', 'amqplib', '>=0.10.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'amqplib@${version}'`], false, + sandbox = await linkedSandbox([`'amqplib@${version}'`], false, ['./packages/datadog-plugin-amqplib/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'amqplib', 'connect') }) diff --git a/packages/datadog-plugin-anthropic/test/integration-test/client.spec.js b/packages/datadog-plugin-anthropic/test/integration-test/client.spec.js index 6f06527336f..84ed0a9c992 100644 --- a/packages/datadog-plugin-anthropic/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-anthropic/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('anthropic', ['@anthropic-ai/sdk'], version => { before(async function () { this.timeout(20000) - sandbox = await createSandbox([ + sandbox = await linkedSandbox([ `@anthropic-ai/sdk@${version}`, ], false, [ './packages/datadog-plugin-anthropic/test/integration-test/*' diff --git a/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js b/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js index 4e93c23fa77..c92045b16ed 100644 --- a/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('aws-sdk', ['aws-sdk'], version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'aws-sdk@${version}'`], false, [ + sandbox = await linkedSandbox([`'aws-sdk@${version}'`], false, [ './packages/datadog-plugin-aws-sdk/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-axios/test/integration-test/client.spec.js b/packages/datadog-plugin-axios/test/integration-test/client.spec.js index 13f0bb0978b..3ff99b47d7b 100644 --- a/packages/datadog-plugin-axios/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-axios/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -15,7 +15,7 @@ describe('esm', () => { before(async function () { this.timeout(60000) - sandbox = await createSandbox(['axios'], false, [ + sandbox = await linkedSandbox(['axios'], false, [ './packages/datadog-plugin-axios/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-azure-event-hubs/test/integration-test/client.spec.js b/packages/datadog-plugin-azure-event-hubs/test/integration-test/client.spec.js index 7169cf7ec2a..e238048ec28 100644 --- a/packages/datadog-plugin-azure-event-hubs/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-azure-event-hubs/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -19,7 +19,7 @@ describe('esm', () => { withVersions('azure-event-hubs', '@azure/event-hubs', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'@azure/event-hubs@${version}'`], false, [ + sandbox = await linkedSandbox([`'@azure/event-hubs@${version}'`], false, [ './packages/datadog-plugin-azure-event-hubs/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-azure-functions/test/integration-test/eventhubs-test/eventhubs.spec.js b/packages/datadog-plugin-azure-functions/test/integration-test/eventhubs-test/eventhubs.spec.js index 6e6ef3c4c04..563caac75f1 100644 --- a/packages/datadog-plugin-azure-functions/test/integration-test/eventhubs-test/eventhubs.spec.js +++ b/packages/datadog-plugin-azure-functions/test/integration-test/eventhubs-test/eventhubs.spec.js @@ -3,7 +3,7 @@ const { FakeAgent, hookFile, - createSandbox, + linkedSandbox, curlAndAssertMessage, } = require('../../../../../integration-tests/helpers') const { withVersions } = require('../../../../dd-trace/test/setup/mocha') @@ -21,7 +21,7 @@ describe('esm', () => { withVersions('azure-functions', '@azure/functions', NODE_MAJOR < 20 ? '<4.7.3' : '*', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([ + sandbox = await linkedSandbox([ `@azure/functions@${version}`, 'azure-functions-core-tools@4', '@azure/event-hubs@6.0.0', diff --git a/packages/datadog-plugin-azure-functions/test/integration-test/http-test/client.spec.js b/packages/datadog-plugin-azure-functions/test/integration-test/http-test/client.spec.js index ff9b3d20246..2f5dc2bdd55 100644 --- a/packages/datadog-plugin-azure-functions/test/integration-test/http-test/client.spec.js +++ b/packages/datadog-plugin-azure-functions/test/integration-test/http-test/client.spec.js @@ -3,7 +3,7 @@ const { FakeAgent, hookFile, - createSandbox, + linkedSandbox, curlAndAssertMessage } = require('../../../../../integration-tests/helpers') const { withVersions } = require('../../../../dd-trace/test/setup/mocha') @@ -21,7 +21,7 @@ describe('esm', () => { withVersions('azure-functions', '@azure/functions', NODE_MAJOR < 20 ? '<4.7.3' : '*', version => { before(async function () { this.timeout(120_000) - sandbox = await createSandbox([ + sandbox = await linkedSandbox([ `@azure/functions@${version}`, 'azure-functions-core-tools@4', ], diff --git a/packages/datadog-plugin-azure-functions/test/integration-test/servicebus-test/servicebus.spec.js b/packages/datadog-plugin-azure-functions/test/integration-test/servicebus-test/servicebus.spec.js index 0cb0f12ed02..6296214e4a4 100644 --- a/packages/datadog-plugin-azure-functions/test/integration-test/servicebus-test/servicebus.spec.js +++ b/packages/datadog-plugin-azure-functions/test/integration-test/servicebus-test/servicebus.spec.js @@ -3,7 +3,7 @@ const { FakeAgent, hookFile, - createSandbox, + linkedSandbox, curlAndAssertMessage } = require('../../../../../integration-tests/helpers') const { withVersions } = require('../../../../dd-trace/test/setup/mocha') @@ -21,7 +21,7 @@ describe('esm', () => { withVersions('azure-functions', '@azure/functions', NODE_MAJOR < 20 ? '<4.7.3' : '*', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([ + sandbox = await linkedSandbox([ `@azure/functions@${version}`, 'azure-functions-core-tools@4', '@azure/service-bus@7.9.5', diff --git a/packages/datadog-plugin-azure-service-bus/test/integration-test/client.spec.js b/packages/datadog-plugin-azure-service-bus/test/integration-test/client.spec.js index e082770f0a3..0cd559c4f8f 100644 --- a/packages/datadog-plugin-azure-service-bus/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-azure-service-bus/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') const { withVersions } = require('../../../dd-trace/test/setup/mocha') @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('azure-service-bus', '@azure/service-bus', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'@azure/service-bus@${version}'`], false, [ + sandbox = await linkedSandbox([`'@azure/service-bus@${version}'`], false, [ './packages/datadog-plugin-azure-service-bus/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-bunyan/test/integration-test/client.spec.js b/packages/datadog-plugin-bunyan/test/integration-test/client.spec.js index b26c6fd2951..83c446fcefb 100644 --- a/packages/datadog-plugin-bunyan/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-bunyan/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, spawnPluginIntegrationTestProc, varySandbox } = require('../../../../integration-tests/helpers') @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('bunyan', 'bunyan', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'bunyan@${version}'`], false, + sandbox = await linkedSandbox([`'bunyan@${version}'`], false, ['./packages/datadog-plugin-bunyan/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'bunyan') }) diff --git a/packages/datadog-plugin-cassandra-driver/test/integration-test/client.spec.js b/packages/datadog-plugin-cassandra-driver/test/integration-test/client.spec.js index 32a6ab43f92..85d62de53e3 100644 --- a/packages/datadog-plugin-cassandra-driver/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-cassandra-driver/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -20,7 +20,7 @@ describe('esm', () => { withVersions('cassandra-driver', 'cassandra-driver', '>=4.4.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'cassandra-driver@${version}'`], false, [ + sandbox = await linkedSandbox([`'cassandra-driver@${version}'`], false, [ './packages/datadog-plugin-cassandra-driver/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'cassandra-driver', 'Client') }) diff --git a/packages/datadog-plugin-confluentinc-kafka-javascript/test/integration-test/client.spec.js b/packages/datadog-plugin-confluentinc-kafka-javascript/test/integration-test/client.spec.js index 2e61d54cfd1..bf3a24c62c6 100644 --- a/packages/datadog-plugin-confluentinc-kafka-javascript/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-confluentinc-kafka-javascript/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -16,7 +16,7 @@ describe('esm', () => { withVersions('confluentinc-kafka-javascript', '@confluentinc/kafka-javascript', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'@confluentinc/kafka-javascript@${version}'`], false, [ + sandbox = await linkedSandbox([`'@confluentinc/kafka-javascript@${version}'`], false, [ './packages/datadog-plugin-confluentinc-kafka-javascript/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-connect/test/integration-test/client.spec.js b/packages/datadog-plugin-connect/test/integration-test/client.spec.js index 8d2d5b59856..de463ffd3e5 100644 --- a/packages/datadog-plugin-connect/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-connect/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, checkSpansForServiceName, spawnPluginIntegrationTestProc, @@ -20,7 +20,7 @@ describe('esm', () => { withVersions('connect', 'connect', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'connect@${version}'`], false, [ + sandbox = await linkedSandbox([`'connect@${version}'`], false, [ './packages/datadog-plugin-connect/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'connect') }) diff --git a/packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js b/packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js index 0086f3fb7e8..cf533b06539 100644 --- a/packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js @@ -1,7 +1,7 @@ 'use strict' const { - createSandbox, varySandbox, curl, + linkedSandbox, varySandbox, curl, FakeAgent, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') const { assert } = require('chai') @@ -13,7 +13,7 @@ withVersions('cookie-parser', 'cookie-parser', version => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([`'cookie-parser@${version}'`, 'express'], false, + sandbox = await linkedSandbox([`'cookie-parser@${version}'`, 'express'], false, ['./packages/datadog-plugin-cookie-parser/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'cookie-parser', 'cookieParser') }) diff --git a/packages/datadog-plugin-couchbase/test/integration-test/client.spec.js b/packages/datadog-plugin-couchbase/test/integration-test/client.spec.js index 0edf5fda001..8155e8e481c 100644 --- a/packages/datadog-plugin-couchbase/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-couchbase/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('couchbase', 'couchbase', '>=4.0.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'couchbase@${version}'`], false, [ + sandbox = await linkedSandbox([`'couchbase@${version}'`], false, [ './packages/datadog-plugin-couchbase/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-dns/test/integration-test/client.spec.js b/packages/datadog-plugin-dns/test/integration-test/client.spec.js index 4fe489b6453..238fda24c5a 100644 --- a/packages/datadog-plugin-dns/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-dns/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([], false, [ + sandbox = await linkedSandbox([], false, [ './packages/datadog-plugin-dns/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'dns', 'lookup') }) diff --git a/packages/datadog-plugin-elasticsearch/test/integration-test/client.spec.js b/packages/datadog-plugin-elasticsearch/test/integration-test/client.spec.js index 78dc3d3d024..883e6431eae 100644 --- a/packages/datadog-plugin-elasticsearch/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-elasticsearch/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -20,7 +20,7 @@ describe('esm', () => { withVersions('elasticsearch', ['@elastic/elasticsearch'], '<8.16.0 || >8.16.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'@elastic/elasticsearch@${version}'`], false, [ + sandbox = await linkedSandbox([`'@elastic/elasticsearch@${version}'`], false, [ './packages/datadog-plugin-elasticsearch/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'elasticsearch', undefined, '@elastic/elasticsearch') }) diff --git a/packages/datadog-plugin-express/test/integration-test/client.spec.js b/packages/datadog-plugin-express/test/integration-test/client.spec.js index dba15ef112e..3280d4c2698 100644 --- a/packages/datadog-plugin-express/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-express/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, spawnPluginIntegrationTestProc, varySandbox @@ -20,7 +20,7 @@ describe('esm', () => { withVersions('express', 'express', version => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([`'express@${version}'`], false, + sandbox = await linkedSandbox([`'express@${version}'`], false, ['./packages/datadog-plugin-express/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'express') }) diff --git a/packages/datadog-plugin-fetch/test/integration-test/client.spec.js b/packages/datadog-plugin-fetch/test/integration-test/client.spec.js index ff6dbb2141e..aa25785284f 100644 --- a/packages/datadog-plugin-fetch/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-fetch/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') const { assert } = require('chai') @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([], false, [ + sandbox = await linkedSandbox([], false, [ './packages/datadog-plugin-fetch/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-google-cloud-pubsub/test/integration-test/client.spec.js b/packages/datadog-plugin-google-cloud-pubsub/test/integration-test/client.spec.js index d84b0b69e99..9566b5d4b87 100644 --- a/packages/datadog-plugin-google-cloud-pubsub/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-google-cloud-pubsub/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('google-cloud-pubsub', '@google-cloud/pubsub', '>=4.0.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'@google-cloud/pubsub@${version}'`], false, ['./packages/dd-trace/src/id.js', + sandbox = await linkedSandbox([`'@google-cloud/pubsub@${version}'`], false, ['./packages/dd-trace/src/id.js', './packages/datadog-plugin-google-cloud-pubsub/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-google-cloud-vertexai/test/integration-test/client.spec.js b/packages/datadog-plugin-google-cloud-vertexai/test/integration-test/client.spec.js index 31ac3e5f43a..3e04c52ead8 100644 --- a/packages/datadog-plugin-google-cloud-vertexai/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-google-cloud-vertexai/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('google-cloud-vertexai', '@google-cloud/vertexai', '>=1', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([ + sandbox = await linkedSandbox([ `@google-cloud/vertexai@${version}`, 'sinon' ], false, [ diff --git a/packages/datadog-plugin-graphql/test/esm-test/esm.spec.js b/packages/datadog-plugin-graphql/test/esm-test/esm.spec.js index 59429210a89..e894ef0b85e 100644 --- a/packages/datadog-plugin-graphql/test/esm-test/esm.spec.js +++ b/packages/datadog-plugin-graphql/test/esm-test/esm.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -20,7 +20,7 @@ describe('Plugin (ESM)', () => { withVersions('graphql', ['graphql'], (version, moduleName, resolvedVersion) => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([`'graphql@${resolvedVersion}'`, "'graphql-yoga@3.6.0'"], false, [ + sandbox = await linkedSandbox([`'graphql@${resolvedVersion}'`, "'graphql-yoga@3.6.0'"], false, [ './packages/datadog-plugin-graphql/test/esm-test/*']) }) diff --git a/packages/datadog-plugin-graphql/test/integration-test/client.spec.js b/packages/datadog-plugin-graphql/test/integration-test/client.spec.js index 2a095b4b753..8726572c3ed 100644 --- a/packages/datadog-plugin-graphql/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-graphql/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('graphql', 'graphql', version => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([`'graphql@${version}'`], false, [ + sandbox = await linkedSandbox([`'graphql@${version}'`], false, [ './packages/datadog-plugin-graphql/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-grpc/test/integration-test/client.spec.js b/packages/datadog-plugin-grpc/test/integration-test/client.spec.js index e489dede202..7565f2b7146 100644 --- a/packages/datadog-plugin-grpc/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-grpc/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('grpc', '@grpc/grpc-js', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'@grpc/grpc-js@${version}'`, '@grpc/proto-loader'], false, [ + sandbox = await linkedSandbox([`'@grpc/grpc-js@${version}'`, '@grpc/proto-loader'], false, [ './packages/datadog-plugin-grpc/test/*']) }) diff --git a/packages/datadog-plugin-hapi/test/integration-test/client.spec.js b/packages/datadog-plugin-hapi/test/integration-test/client.spec.js index a6e38641fc0..349c3d951ec 100644 --- a/packages/datadog-plugin-hapi/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-hapi/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, checkSpansForServiceName, spawnPluginIntegrationTestProc @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('hapi', '@hapi/hapi', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'@hapi/hapi@${version}'`], false, [ + sandbox = await linkedSandbox([`'@hapi/hapi@${version}'`], false, [ './packages/datadog-plugin-hapi/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-hono/test/integration-test/client.spec.js b/packages/datadog-plugin-hono/test/integration-test/client.spec.js index b9d71d7cbe4..d1423be32c2 100644 --- a/packages/datadog-plugin-hono/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-hono/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, spawnPluginIntegrationTestProc, assertObjectContains, @@ -17,7 +17,7 @@ describe('esm integration test', () => { withVersions('hono', 'hono', (range, _moduleName_, version) => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([`'hono@${range}'`, '@hono/node-server@1.15.0'], false, + sandbox = await linkedSandbox([`'hono@${range}'`, '@hono/node-server@1.15.0'], false, ['./packages/datadog-plugin-hono/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-http/test/integration-test/client.spec.js b/packages/datadog-plugin-http/test/integration-test/client.spec.js index 6c4b07ba3d1..41c838e28b2 100644 --- a/packages/datadog-plugin-http/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-http/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -15,7 +15,7 @@ describe('esm', () => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([], false, [ + sandbox = await linkedSandbox([], false, [ './packages/datadog-plugin-http/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-http2/test/integration-test/client.spec.js b/packages/datadog-plugin-http2/test/integration-test/client.spec.js index 0e504853076..35ade471c13 100644 --- a/packages/datadog-plugin-http2/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-http2/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, spawnPluginIntegrationTestProc, varySandbox } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) - sandbox = await createSandbox(['http2'], false, [ + sandbox = await linkedSandbox(['http2'], false, [ './packages/datadog-plugin-http2/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'http2', 'createServer') }) diff --git a/packages/datadog-plugin-ioredis/test/integration-test/client.spec.js b/packages/datadog-plugin-ioredis/test/integration-test/client.spec.js index e3b2539abbf..9b1fef6d5f9 100644 --- a/packages/datadog-plugin-ioredis/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-ioredis/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('ioredis', 'ioredis', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'ioredis@${version}'`], false, [ + sandbox = await linkedSandbox([`'ioredis@${version}'`], false, [ './packages/datadog-plugin-ioredis/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'ioredis') }) diff --git a/packages/datadog-plugin-iovalkey/test/integration-test/client.spec.js b/packages/datadog-plugin-iovalkey/test/integration-test/client.spec.js index 57da3d2f2a5..16a4cb13443 100644 --- a/packages/datadog-plugin-iovalkey/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-iovalkey/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -16,7 +16,7 @@ describe('esm', () => { withVersions('iovalkey', 'iovalkey', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'iovalkey@${version}'`], false, [ + sandbox = await linkedSandbox([`'iovalkey@${version}'`], false, [ './packages/datadog-plugin-iovalkey/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-kafkajs/test/integration-test/client.spec.js b/packages/datadog-plugin-kafkajs/test/integration-test/client.spec.js index b778a36e3b7..99687aed1c3 100644 --- a/packages/datadog-plugin-kafkajs/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-kafkajs/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -16,7 +16,7 @@ describe('esm', () => { withVersions('kafkajs', 'kafkajs', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'kafkajs@${version}'`], false, [ + sandbox = await linkedSandbox([`'kafkajs@${version}'`], false, [ './packages/datadog-plugin-kafkajs/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-koa/test/integration-test/client.spec.js b/packages/datadog-plugin-koa/test/integration-test/client.spec.js index d1f1a430b4e..5ff6f2647f4 100644 --- a/packages/datadog-plugin-koa/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-koa/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, checkSpansForServiceName, spawnPluginIntegrationTestProc @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('koa', 'koa', version => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([`'koa@${version}'`], false, + sandbox = await linkedSandbox([`'koa@${version}'`], false, ['./packages/datadog-plugin-koa/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-langchain/test/integration-test/client.spec.js b/packages/datadog-plugin-langchain/test/integration-test/client.spec.js index 3dcf3fbfe78..1ab5488698c 100644 --- a/packages/datadog-plugin-langchain/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-langchain/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('langchain', ['@langchain/core'], '>=0.1', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([ + sandbox = await linkedSandbox([ `@langchain/core@${version}`, `@langchain/openai@${version}`, 'nock' diff --git a/packages/datadog-plugin-limitd-client/test/integration-test/client.spec.js b/packages/datadog-plugin-limitd-client/test/integration-test/client.spec.js index b76fa0ed2bf..73f824a75b3 100644 --- a/packages/datadog-plugin-limitd-client/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-limitd-client/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -19,7 +19,7 @@ describe('esm', () => { withVersions('limitd-client', 'limitd-client', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'limitd-client@${version}'`], false, [ + sandbox = await linkedSandbox([`'limitd-client@${version}'`], false, [ './packages/datadog-plugin-limitd-client/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'limitd-client') }) diff --git a/packages/datadog-plugin-mariadb/test/integration-test/client.spec.js b/packages/datadog-plugin-mariadb/test/integration-test/client.spec.js index 387b41d6866..51157ba2668 100644 --- a/packages/datadog-plugin-mariadb/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mariadb/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('mariadb', 'mariadb', '>=3.0.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'mariadb@${version}'`], false, [ + sandbox = await linkedSandbox([`'mariadb@${version}'`], false, [ './packages/datadog-plugin-mariadb/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-memcached/test/integration-test/client.spec.js b/packages/datadog-plugin-memcached/test/integration-test/client.spec.js index 3ce696b5947..9c23a589ca9 100644 --- a/packages/datadog-plugin-memcached/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-memcached/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('memcached', 'memcached', version => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([`'memcached@${version}'`], false, [ + sandbox = await linkedSandbox([`'memcached@${version}'`], false, [ './packages/datadog-plugin-memcached/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-microgateway-core/test/integration-test/client.spec.js b/packages/datadog-plugin-microgateway-core/test/integration-test/client.spec.js index 19229bc1511..b7d5c385821 100644 --- a/packages/datadog-plugin-microgateway-core/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-microgateway-core/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, checkSpansForServiceName, spawnPluginIntegrationTestProc @@ -19,7 +19,7 @@ describe('esm', () => { withVersions('microgateway-core', 'microgateway-core', '>=3.0.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'microgateway-core@${version}'`], false, [ + sandbox = await linkedSandbox([`'microgateway-core@${version}'`], false, [ './packages/datadog-plugin-microgateway-core/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-moleculer/test/integration-test/client.spec.js b/packages/datadog-plugin-moleculer/test/integration-test/client.spec.js index 3193ace422f..c542fa58cce 100644 --- a/packages/datadog-plugin-moleculer/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-moleculer/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('moleculer', 'moleculer', '>0.14.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'moleculer@${version}'`], false, [ + sandbox = await linkedSandbox([`'moleculer@${version}'`], false, [ './packages/datadog-plugin-moleculer/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-mongodb-core/test/integration-test/client.spec.js b/packages/datadog-plugin-mongodb-core/test/integration-test/client.spec.js index e8fe7491033..4590e9a8655 100644 --- a/packages/datadog-plugin-mongodb-core/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mongodb-core/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -19,7 +19,7 @@ describe('esm', () => { withVersions('mongodb-core', 'mongodb', '>=4', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'mongodb@${version}'`], false, [ + sandbox = await linkedSandbox([`'mongodb@${version}'`], false, [ './packages/datadog-plugin-mongodb-core/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'mongodb', 'MongoClient') }) @@ -56,7 +56,7 @@ describe('esm', () => { withVersions('mongodb-core', 'mongodb-core', '>=3', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'mongodb-core@${version}'`], false, [ + sandbox = await linkedSandbox([`'mongodb-core@${version}'`], false, [ './packages/datadog-plugin-mongodb-core/test/integration-test/*']) variants = varySandbox(sandbox, 'server2.mjs', 'MongoDBCore') }) diff --git a/packages/datadog-plugin-mongoose/test/integration-test/client.spec.js b/packages/datadog-plugin-mongoose/test/integration-test/client.spec.js index 97a0ee4ea6b..77944f49fdf 100644 --- a/packages/datadog-plugin-mongoose/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mongoose/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -19,7 +19,7 @@ describe('esm', () => { withVersions('mongoose', ['mongoose'], '>=4', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'mongoose@${version}'`], false, [ + sandbox = await linkedSandbox([`'mongoose@${version}'`], false, [ './packages/datadog-plugin-mongoose/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'mongoose') }) diff --git a/packages/datadog-plugin-mysql/test/integration-test/client.spec.js b/packages/datadog-plugin-mysql/test/integration-test/client.spec.js index 0c4060d63c6..36e3cf14aaf 100644 --- a/packages/datadog-plugin-mysql/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mysql/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -19,7 +19,7 @@ describe('esm', () => { withVersions('mysql', 'mysql', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'mysql@${version}'`], false, [ + sandbox = await linkedSandbox([`'mysql@${version}'`], false, [ './packages/datadog-plugin-mysql/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'mysql', 'createConnection') }) diff --git a/packages/datadog-plugin-mysql2/test/integration-test/client.spec.js b/packages/datadog-plugin-mysql2/test/integration-test/client.spec.js index 8997d50f168..17206995a33 100644 --- a/packages/datadog-plugin-mysql2/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mysql2/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('mysql2', 'mysql2', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'mysql2@${version}'`], false, [ + sandbox = await linkedSandbox([`'mysql2@${version}'`], false, [ './packages/datadog-plugin-mysql2/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-net/test/integration-test/client.spec.js b/packages/datadog-plugin-net/test/integration-test/client.spec.js index ee0fb301031..129cc3fbd92 100644 --- a/packages/datadog-plugin-net/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-net/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(60000) - sandbox = await createSandbox(['net'], false, [ + sandbox = await linkedSandbox(['net'], false, [ './packages/datadog-plugin-net/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'net', 'createConnection') }) diff --git a/packages/datadog-plugin-next/test/integration-test/client.spec.js b/packages/datadog-plugin-next/test/integration-test/client.spec.js index 798115fe239..348cf3e195b 100644 --- a/packages/datadog-plugin-next/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-next/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, checkSpansForServiceName, spawnPluginIntegrationTestProc, @@ -23,7 +23,7 @@ describe('esm', () => { before(async function () { // next builds slower in the CI, match timeout with unit tests this.timeout(300 * 1000) - sandbox = await createSandbox([`'next@${version}'`, 'react@^18.2.0', 'react-dom@^18.2.0'], + sandbox = await linkedSandbox([`'next@${version}'`, 'react@^18.2.0', 'react-dom@^18.2.0'], false, ['./packages/datadog-plugin-next/test/integration-test/*'], 'NODE_OPTIONS=--openssl-legacy-provider yarn exec next build') variants = varySandbox(sandbox, 'server.mjs', 'next') diff --git a/packages/datadog-plugin-openai/test/integration-test/client.spec.js b/packages/datadog-plugin-openai/test/integration-test/client.spec.js index 74b855395ec..1c489fea4a4 100644 --- a/packages/datadog-plugin-openai/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-openai/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, } = require('../../../../integration-tests/helpers') @@ -20,7 +20,7 @@ describe('esm', () => { withVersions('openai', 'openai', '>=3 <4.0.0 || >4.1.0', (version) => { before(async function () { this.timeout(60000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( [ `'openai@${version}'`, 'nock', diff --git a/packages/datadog-plugin-opensearch/test/integration-test/client.spec.js b/packages/datadog-plugin-opensearch/test/integration-test/client.spec.js index 8dee287a1af..66d0c121a7c 100644 --- a/packages/datadog-plugin-opensearch/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-opensearch/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('opensearch', '@opensearch-project/opensearch', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'@opensearch-project/opensearch@${version}'`], false, [ + sandbox = await linkedSandbox([`'@opensearch-project/opensearch@${version}'`], false, [ './packages/datadog-plugin-opensearch/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-oracledb/test/integration-test/client.spec.js b/packages/datadog-plugin-oracledb/test/integration-test/client.spec.js index 5fb44e0d0db..f9fa5ad8940 100644 --- a/packages/datadog-plugin-oracledb/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-oracledb/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('oracledb', 'oracledb', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'oracledb@${version}'`], false, [ + sandbox = await linkedSandbox([`'oracledb@${version}'`], false, [ './packages/datadog-plugin-oracledb/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-pg/test/integration-test/client.spec.js b/packages/datadog-plugin-pg/test/integration-test/client.spec.js index db252cb9360..d530adeabb8 100644 --- a/packages/datadog-plugin-pg/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-pg/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -20,7 +20,7 @@ describe('esm', () => { withVersions('pg', 'pg', (version, _, realVersion) => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'pg@${version}'`], false, [ + sandbox = await linkedSandbox([`'pg@${version}'`], false, [ './packages/datadog-plugin-pg/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', { default: 'import pg from \'pg\'', diff --git a/packages/datadog-plugin-pino/test/integration-test/client.spec.js b/packages/datadog-plugin-pino/test/integration-test/client.spec.js index 9a60f326628..41a26ffbf43 100644 --- a/packages/datadog-plugin-pino/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-pino/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, spawnPluginIntegrationTestProc, varySandbox } = require('../../../../integration-tests/helpers') @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('pino', 'pino', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'pino@${version}'`], + sandbox = await linkedSandbox([`'pino@${version}'`], false, ['./packages/datadog-plugin-pino/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'pino') }) diff --git a/packages/datadog-plugin-prisma/test/integration-test/client.spec.js b/packages/datadog-plugin-prisma/test/integration-test/client.spec.js index d1754fa3d33..2c5383dbcba 100644 --- a/packages/datadog-plugin-prisma/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-prisma/test/integration-test/client.spec.js @@ -7,7 +7,7 @@ const { describe, it, beforeEach, before, after, afterEach } = require('mocha') const { FakeAgent, - createSandbox, + linkedSandbox, spawnPluginIntegrationTestProc, assertObjectContains } = require('../../../../integration-tests/helpers') @@ -21,7 +21,7 @@ describe('esm', () => { withVersions('prisma', '@prisma/client', version => { before(async function () { this.timeout(100000) - sandbox = await createSandbox([`'prisma@${version}'`, `'@prisma/client@${version}'`], false, [ + sandbox = await linkedSandbox([`'prisma@${version}'`, `'@prisma/client@${version}'`], false, [ './packages/datadog-plugin-prisma/test/integration-test/*', './packages/datadog-plugin-prisma/test/schema.prisma' ]) diff --git a/packages/datadog-plugin-redis/test/integration-test/client.spec.js b/packages/datadog-plugin-redis/test/integration-test/client.spec.js index 6017ad3966c..ad3d28a85da 100644 --- a/packages/datadog-plugin-redis/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-redis/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('redis', 'redis', '>=4', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'redis@${version}'`], false, [ + sandbox = await linkedSandbox([`'redis@${version}'`], false, [ './packages/datadog-plugin-redis/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-restify/test/integration-test/client.spec.js b/packages/datadog-plugin-restify/test/integration-test/client.spec.js index aded6631aba..19cc7556ec0 100644 --- a/packages/datadog-plugin-restify/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-restify/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, checkSpansForServiceName, spawnPluginIntegrationTestProc @@ -19,7 +19,7 @@ describe('esm', () => { withVersions('restify', 'restify', '>3', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'restify@${version}'`], + sandbox = await linkedSandbox([`'restify@${version}'`], false, ['./packages/datadog-plugin-restify/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-rhea/test/integration-test/client.spec.js b/packages/datadog-plugin-rhea/test/integration-test/client.spec.js index d90b1afba7b..5c6bfa4bc12 100644 --- a/packages/datadog-plugin-rhea/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-rhea/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('rhea', 'rhea', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'rhea@${version}'`], false, [ + sandbox = await linkedSandbox([`'rhea@${version}'`], false, [ './packages/datadog-plugin-rhea/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-router/test/integration-test/client.spec.js b/packages/datadog-plugin-router/test/integration-test/client.spec.js index d412c529153..002d6ca802a 100644 --- a/packages/datadog-plugin-router/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-router/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, curlAndAssertMessage, checkSpansForServiceName, spawnPluginIntegrationTestProc @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('router', 'router', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'router@${version}'`] + sandbox = await linkedSandbox([`'router@${version}'`] , false, ['./packages/datadog-plugin-router/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-sharedb/test/integration-test/client.spec.js b/packages/datadog-plugin-sharedb/test/integration-test/client.spec.js index 98c97cd61a9..f063dc3aa85 100644 --- a/packages/datadog-plugin-sharedb/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-sharedb/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -18,7 +18,7 @@ describe('esm', () => { withVersions('sharedb', 'sharedb', '>=3', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'sharedb@${version}'`], false, [ + sandbox = await linkedSandbox([`'sharedb@${version}'`], false, [ './packages/datadog-plugin-sharedb/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-tedious/test/integration-test/client.spec.js b/packages/datadog-plugin-tedious/test/integration-test/client.spec.js index 19b19a93a03..9df5af0ad67 100644 --- a/packages/datadog-plugin-tedious/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-tedious/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') @@ -24,7 +24,7 @@ describe('esm', () => { withVersions('tedious', 'tedious', '>=16.0.0', version => { before(async function () { this.timeout(60000) - sandbox = await createSandbox([`'tedious@${version}'`], false, [ + sandbox = await linkedSandbox([`'tedious@${version}'`], false, [ './packages/datadog-plugin-tedious/test/integration-test/*']) }) diff --git a/packages/datadog-plugin-winston/test/integration-test/client.spec.js b/packages/datadog-plugin-winston/test/integration-test/client.spec.js index 496eaf890f7..d29d82b65fb 100644 --- a/packages/datadog-plugin-winston/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-winston/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox, + linkedSandbox, spawnPluginIntegrationTestProc } = require('../../../../integration-tests/helpers') const { withVersions } = require('../../../dd-trace/test/setup/mocha') @@ -17,7 +17,7 @@ describe('esm', () => { withVersions('winston', 'winston', '>=3', version => { before(async function () { this.timeout(50000) - sandbox = await createSandbox([`'winston@${version}'`] + sandbox = await linkedSandbox([`'winston@${version}'`] , false, ['./packages/datadog-plugin-winston/test/integration-test/*']) }) From 7b2eada2f5fab10355f480b4e0a8fb17d6bc6bec Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 11:35:03 -0400 Subject: [PATCH 03/12] fix yarn add without dependencies --- integration-tests/helpers/index.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/integration-tests/helpers/index.js b/integration-tests/helpers/index.js index b95f36c5f86..52bac1c53ec 100644 --- a/integration-tests/helpers/index.js +++ b/integration-tests/helpers/index.js @@ -279,7 +279,7 @@ async function createSandbox (dependencies = [], isGitRepo = false, } const folder = path.join(os.tmpdir(), id().toString()) const out = path.join(folder, `dd-trace-${version}.tgz`) - const deps = cappedDependencies.join(' ') + const deps = cappedDependencies await fs.mkdir(folder) const addOptions = { cwd: folder, env: restOfEnv } @@ -291,11 +291,12 @@ async function createSandbox (dependencies = [], isGitRepo = false, if (isolated) { execHelper(`npm pack --silent --pack-destination ${folder}`, { env: restOfEnv }) - execHelper(`yarn add ${deps} file:${out}`, addOptions) + execHelper(`yarn add ${deps.concat(`file:${out}`).join(' ')}`, addOptions) } else { - [`file:${out}`].concat(cappedDependencies) execHelper('yarn link') - execHelper(`yarn add ${deps}`, addOptions) + if (deps.length > 0) { + execHelper(`yarn add ${deps.join(' ')}`, addOptions) + } execHelper('yarn link dd-trace', addOptions) } @@ -405,11 +406,6 @@ function varySandbox (sandbox, filename, variants, namedVariant, packageName = v return variantFilenames } -/** - * @type {['default', 'star', 'destructure']} - */ -varySandbox.VARIANTS = ['default', 'star', 'destructure'] - /** * @param {boolean} shouldExpectTelemetryPoints */ From 56c7c7c82c34e8d7ff73398dd580ecffbe366034 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 11:48:30 -0400 Subject: [PATCH 04/12] undo eslint weirdness --- integration-tests/helpers/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/integration-tests/helpers/index.js b/integration-tests/helpers/index.js index 52bac1c53ec..d4ecca0ff52 100644 --- a/integration-tests/helpers/index.js +++ b/integration-tests/helpers/index.js @@ -406,6 +406,11 @@ function varySandbox (sandbox, filename, variants, namedVariant, packageName = v return variantFilenames } +/** + * @type {['default', 'star', 'destructure']} + */ +varySandbox.VARIANTS = ['default', 'star', 'destructure'] + /** * @param {boolean} shouldExpectTelemetryPoints */ From ba8672ee613069259b182b5c5238d400e0231cf1 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 13:06:45 -0400 Subject: [PATCH 05/12] move eveverything to specialized sandboxes --- integration-tests/aiguard/index.spec.js | 4 ++-- integration-tests/appsec/data-collection.spec.js | 4 ++-- integration-tests/appsec/endpoints-collection.spec.js | 4 ++-- integration-tests/appsec/graphql.spec.js | 4 ++-- integration-tests/appsec/iast-esbuild.spec.js | 4 ++-- integration-tests/appsec/iast.esm-security-controls.spec.js | 4 ++-- integration-tests/appsec/iast.esm.spec.js | 4 ++-- integration-tests/appsec/index.spec.js | 4 ++-- integration-tests/appsec/multer.spec.js | 4 ++-- integration-tests/appsec/response-headers.spec.js | 4 ++-- integration-tests/appsec/standalone-asm.spec.js | 4 ++-- integration-tests/appsec/trace-tagging.spec.js | 6 +++--- .../ci-visibility/automatic-log-submission.spec.js | 4 ++-- integration-tests/ci-visibility/git-cache.spec.js | 4 ++-- integration-tests/ci-visibility/test-api-manual.spec.js | 4 ++-- .../ci-visibility/test-optimization-startup.spec.js | 4 ++-- .../ci-visibility/test-optimization-wrong-init.spec.js | 4 ++-- integration-tests/code-origin.spec.js | 4 ++-- integration-tests/cucumber/cucumber.spec.js | 4 ++-- integration-tests/cypress/cypress.spec.js | 4 ++-- integration-tests/debugger/re-evaluation.spec.js | 4 ++-- integration-tests/debugger/utils.js | 4 ++-- integration-tests/helpers/index.js | 1 - integration-tests/jest/jest.spec.js | 4 ++-- integration-tests/log_injection.spec.js | 4 ++-- integration-tests/mocha/mocha.spec.js | 4 ++-- .../openfeature/openfeature-exposure-events.spec.js | 4 ++-- integration-tests/opentelemetry-logs.spec.js | 4 ++-- integration-tests/opentelemetry.spec.js | 4 ++-- integration-tests/pino.spec.js | 4 ++-- integration-tests/playwright/playwright.spec.js | 4 ++-- integration-tests/profiler/profiler.spec.js | 4 ++-- integration-tests/remote_config.spec.js | 4 ++-- integration-tests/selenium/selenium.spec.js | 4 ++-- integration-tests/startup.spec.js | 4 ++-- integration-tests/telemetry.spec.js | 4 ++-- integration-tests/vitest/vitest.spec.js | 4 ++-- .../test/appsec/iast/code_injection.integration.spec.js | 4 ++-- .../appsec/iast/overhead-controller.integration.spec.js | 4 ++-- .../test/appsec/rasp/command_injection.integration.spec.js | 4 ++-- .../test/appsec/rasp/lfi.integration.express.plugin.spec.js | 4 ++-- .../test/appsec/rasp/rasp-metrics.integration.spec.js | 4 ++-- .../appsec/rasp/sql_injection.integration.pg.plugin.spec.js | 4 ++-- .../dd-trace/test/appsec/waf-metrics.integration.spec.js | 4 ++-- packages/dd-trace/test/exporters/common/request.spec.js | 4 ++-- packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js | 4 ++-- 46 files changed, 91 insertions(+), 92 deletions(-) diff --git a/integration-tests/aiguard/index.spec.js b/integration-tests/aiguard/index.spec.js index bc64903692c..ccb1c331d47 100644 --- a/integration-tests/aiguard/index.spec.js +++ b/integration-tests/aiguard/index.spec.js @@ -2,7 +2,7 @@ const { describe, it, before, after } = require('mocha') const path = require('path') -const { createSandbox, FakeAgent, spawnProc } = require('../helpers') +const { isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') const startApiMock = require('./api-mock') const { expect } = require('chai') const { executeRequest } = require('./util') @@ -12,7 +12,7 @@ describe('AIGuard SDK integration tests', () => { before(async function () { this.timeout(process.platform === 'win32' ? 90000 : 30000) - sandbox = await createSandbox(['express']) + sandbox = await isolatedSandbox(['express']) cwd = sandbox.folder appFile = path.join(cwd, 'aiguard/server.js') api = await startApiMock() diff --git a/integration-tests/appsec/data-collection.spec.js b/integration-tests/appsec/data-collection.spec.js index 3419a3330d2..33e49b63582 100644 --- a/integration-tests/appsec/data-collection.spec.js +++ b/integration-tests/appsec/data-collection.spec.js @@ -5,7 +5,7 @@ const path = require('path') const Axios = require('axios') const { - createSandbox, + isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') @@ -14,7 +14,7 @@ describe('ASM Data collection', () => { let axios, sandbox, cwd, appFile, agent, proc before(async () => { - sandbox = await createSandbox(['express']) + sandbox = await isolatedSandbox(['express']) cwd = sandbox.folder appFile = path.join(cwd, 'appsec/data-collection/index.js') }) diff --git a/integration-tests/appsec/endpoints-collection.spec.js b/integration-tests/appsec/endpoints-collection.spec.js index 622f81136a3..6c512b74ec6 100644 --- a/integration-tests/appsec/endpoints-collection.spec.js +++ b/integration-tests/appsec/endpoints-collection.spec.js @@ -5,7 +5,7 @@ const { describe, before, after, it } = require('mocha') const path = require('node:path') -const { createSandbox, FakeAgent, spawnProc } = require('../helpers') +const { isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') describe('Endpoints collection', () => { let sandbox, cwd @@ -13,7 +13,7 @@ describe('Endpoints collection', () => { before(async function () { this.timeout(process.platform === 'win32' ? 90000 : 30000) - sandbox = await createSandbox( + sandbox = await isolatedSandbox( ['fastify'], false ) diff --git a/integration-tests/appsec/graphql.spec.js b/integration-tests/appsec/graphql.spec.js index c89beb0012a..ac5d5d007dd 100644 --- a/integration-tests/appsec/graphql.spec.js +++ b/integration-tests/appsec/graphql.spec.js @@ -6,7 +6,7 @@ const axios = require('axios') const { FakeAgent, - createSandbox, + isolatedSandbox, spawnProc } = require('../helpers') @@ -14,7 +14,7 @@ describe('graphql', () => { let sandbox, cwd, agent, webFile, proc before(async function () { - sandbox = await createSandbox(['@apollo/server', 'graphql']) + sandbox = await isolatedSandbox(['@apollo/server', 'graphql']) cwd = sandbox.folder webFile = path.join(cwd, 'graphql/index.js') }) diff --git a/integration-tests/appsec/iast-esbuild.spec.js b/integration-tests/appsec/iast-esbuild.spec.js index 71e8de09c80..750161fba48 100644 --- a/integration-tests/appsec/iast-esbuild.spec.js +++ b/integration-tests/appsec/iast-esbuild.spec.js @@ -8,7 +8,7 @@ const path = require('path') const { promisify } = require('util') const msgpack = require('@msgpack/msgpack') -const { createSandbox, FakeAgent, spawnProc } = require('../helpers') +const { isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') const exec = promisify(childProcess.exec) @@ -18,7 +18,7 @@ describe('esbuild support for IAST', () => { let applicationDir, bundledApplicationDir before(async () => { - sandbox = await createSandbox([]) + sandbox = await isolatedSandbox([]) const cwd = sandbox.folder applicationDir = path.join(cwd, 'appsec/iast-esbuild') diff --git a/integration-tests/appsec/iast.esm-security-controls.spec.js b/integration-tests/appsec/iast.esm-security-controls.spec.js index b18974f9656..7ebd61a77ed 100644 --- a/integration-tests/appsec/iast.esm-security-controls.spec.js +++ b/integration-tests/appsec/iast.esm-security-controls.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { createSandbox, spawnProc, FakeAgent } = require('../helpers') +const { isolatedSandbox, spawnProc, FakeAgent } = require('../helpers') const path = require('path') const Axios = require('axios') const { assert } = require('chai') @@ -12,7 +12,7 @@ describe('ESM Security controls', () => { describe(`With express v${version}`, () => { before(async function () { this.timeout(process.platform === 'win32' ? 90000 : 30000) - sandbox = await createSandbox([`express@${version}`]) + sandbox = await isolatedSandbox([`express@${version}`]) cwd = sandbox.folder appFile = path.join(cwd, 'appsec', 'esm-security-controls', 'index.mjs') }) diff --git a/integration-tests/appsec/iast.esm.spec.js b/integration-tests/appsec/iast.esm.spec.js index db4b8d7e838..d74c0e80081 100644 --- a/integration-tests/appsec/iast.esm.spec.js +++ b/integration-tests/appsec/iast.esm.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { createSandbox, spawnProc, FakeAgent } = require('../helpers') +const { isolatedSandbox, spawnProc, FakeAgent } = require('../helpers') const path = require('path') const Axios = require('axios') const { assert } = require('chai') @@ -10,7 +10,7 @@ describe('ESM', () => { before(async function () { this.timeout(process.platform === 'win32' ? 90000 : 30000) - sandbox = await createSandbox(['express']) + sandbox = await isolatedSandbox(['express']) cwd = sandbox.folder appFile = path.join(cwd, 'appsec', 'esm-app', 'index.mjs') }) diff --git a/integration-tests/appsec/index.spec.js b/integration-tests/appsec/index.spec.js index 47863e4b6a1..5442d5027c7 100644 --- a/integration-tests/appsec/index.spec.js +++ b/integration-tests/appsec/index.spec.js @@ -4,7 +4,7 @@ const path = require('path') const Axios = require('axios') const { assert } = require('chai') const msgpack = require('@msgpack/msgpack') -const { createSandbox, FakeAgent, spawnProc } = require('../helpers') +const { isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') describe('RASP', () => { let axios, sandbox, cwd, appFile, agent, proc, stdioHandler @@ -14,7 +14,7 @@ describe('RASP', () => { } before(async () => { - sandbox = await createSandbox(['express', 'axios']) + sandbox = await isolatedSandbox(['express', 'axios']) cwd = sandbox.folder appFile = path.join(cwd, 'appsec/rasp/index.js') }) diff --git a/integration-tests/appsec/multer.spec.js b/integration-tests/appsec/multer.spec.js index 503b5b2796b..fc25a988817 100644 --- a/integration-tests/appsec/multer.spec.js +++ b/integration-tests/appsec/multer.spec.js @@ -7,7 +7,7 @@ const { describe, it, beforeEach, afterEach, before, after } = require('mocha') const path = require('node:path') const { - createSandbox, + isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') @@ -18,7 +18,7 @@ describe('multer', () => { ['1.4.4-lts.1', '1.4.5-lts.1'].forEach((version) => { describe(`v${version}`, () => { before(async () => { - sandbox = await createSandbox(['express', `multer@${version}`]) + sandbox = await isolatedSandbox(['express', `multer@${version}`]) cwd = sandbox.folder startupTestFile = path.join(cwd, 'appsec', 'multer', 'index.js') }) diff --git a/integration-tests/appsec/response-headers.spec.js b/integration-tests/appsec/response-headers.spec.js index 5b32ef266ac..d5b10da9cb3 100644 --- a/integration-tests/appsec/response-headers.spec.js +++ b/integration-tests/appsec/response-headers.spec.js @@ -5,7 +5,7 @@ const path = require('path') const Axios = require('axios') const { - createSandbox, + isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') @@ -14,7 +14,7 @@ describe('Headers collection - Fastify', () => { let axios, sandbox, cwd, appFile, agent, proc before(async () => { - sandbox = await createSandbox(['fastify']) + sandbox = await isolatedSandbox(['fastify']) cwd = sandbox.folder appFile = path.join(cwd, 'appsec/data-collection/fastify.js') }) diff --git a/integration-tests/appsec/standalone-asm.spec.js b/integration-tests/appsec/standalone-asm.spec.js index be8b9d489dd..ae7d8c11c21 100644 --- a/integration-tests/appsec/standalone-asm.spec.js +++ b/integration-tests/appsec/standalone-asm.spec.js @@ -4,7 +4,7 @@ const { assert } = require('chai') const path = require('path') const { - createSandbox, + isolatedSandbox, FakeAgent, spawnProc, curlAndAssertMessage, @@ -16,7 +16,7 @@ describe('Standalone ASM', () => { let sandbox, cwd, startupTestFile, agent, proc, env before(async () => { - sandbox = await createSandbox(['express']) + sandbox = await isolatedSandbox(['express']) cwd = sandbox.folder startupTestFile = path.join(cwd, 'standalone-asm/index.js') }) diff --git a/integration-tests/appsec/trace-tagging.spec.js b/integration-tests/appsec/trace-tagging.spec.js index 67d9eccbb52..02d1792a918 100644 --- a/integration-tests/appsec/trace-tagging.spec.js +++ b/integration-tests/appsec/trace-tagging.spec.js @@ -5,7 +5,7 @@ const path = require('path') const Axios = require('axios') const { - createSandbox, + isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') @@ -35,7 +35,7 @@ describe('ASM Trace Tagging rules', () => { describe('express', () => { before(async () => { - sandbox = await createSandbox(['express']) + sandbox = await isolatedSandbox(['express']) cwd = sandbox.folder appFile = path.join(cwd, 'appsec/data-collection/index.js') }) @@ -60,7 +60,7 @@ describe('ASM Trace Tagging rules', () => { describe('fastify', () => { before(async () => { - sandbox = await createSandbox(['fastify']) + sandbox = await isolatedSandbox(['fastify']) cwd = sandbox.folder appFile = path.join(cwd, 'appsec/data-collection/fastify.js') }) diff --git a/integration-tests/ci-visibility/automatic-log-submission.spec.js b/integration-tests/ci-visibility/automatic-log-submission.spec.js index 4f46cdc650e..8e350ecfd20 100644 --- a/integration-tests/ci-visibility/automatic-log-submission.spec.js +++ b/integration-tests/ci-visibility/automatic-log-submission.spec.js @@ -6,7 +6,7 @@ const { once } = require('events') const { assert } = require('chai') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig, getCiVisEvpProxyConfig } = require('../helpers') @@ -19,7 +19,7 @@ describe('test optimization automatic log submission', () => { let testOutput = '' before(async () => { - sandbox = await createSandbox([ + sandbox = await isolatedSandbox([ 'mocha', '@cucumber/cucumber', 'jest', diff --git a/integration-tests/ci-visibility/git-cache.spec.js b/integration-tests/ci-visibility/git-cache.spec.js index 8a47db8cd68..18dd84dc017 100644 --- a/integration-tests/ci-visibility/git-cache.spec.js +++ b/integration-tests/ci-visibility/git-cache.spec.js @@ -6,7 +6,7 @@ const path = require('path') const os = require('os') const { execSync } = require('child_process') -const { createSandbox } = require('../helpers') +const { isolatedSandbox } = require('../helpers') const FIXED_COMMIT_MESSAGE = 'Test commit message for caching' const GET_COMMIT_MESSAGE_COMMAND_ARGS = ['log', '-1', '--pretty=format:%s'] @@ -30,7 +30,7 @@ describe('git-cache integration tests', () => { let originalCacheEnabled, originalCacheDir before(async () => { - sandbox = await createSandbox([], true) + sandbox = await isolatedSandbox([], true) cwd = sandbox.folder testRepoPath = cwd diff --git a/integration-tests/ci-visibility/test-api-manual.spec.js b/integration-tests/ci-visibility/test-api-manual.spec.js index 09ab26e9764..2a7288b71ba 100644 --- a/integration-tests/ci-visibility/test-api-manual.spec.js +++ b/integration-tests/ci-visibility/test-api-manual.spec.js @@ -5,7 +5,7 @@ const { exec } = require('child_process') const { assert } = require('chai') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig } = require('../helpers') const { FakeCiVisIntake } = require('../ci-visibility-intake') @@ -17,7 +17,7 @@ describe('test-api-manual', () => { let sandbox, cwd, receiver, childProcess before(async () => { - sandbox = await createSandbox([], true) + sandbox = await isolatedSandbox([], true) cwd = sandbox.folder }) diff --git a/integration-tests/ci-visibility/test-optimization-startup.spec.js b/integration-tests/ci-visibility/test-optimization-startup.spec.js index 3347e987f63..a44c5424daf 100644 --- a/integration-tests/ci-visibility/test-optimization-startup.spec.js +++ b/integration-tests/ci-visibility/test-optimization-startup.spec.js @@ -5,7 +5,7 @@ const { once } = require('events') const { assert } = require('chai') -const { createSandbox } = require('../helpers') +const { isolatedSandbox } = require('../helpers') const { FakeCiVisIntake } = require('../ci-visibility-intake') const packageManagers = ['yarn', 'npm', 'pnpm'] @@ -14,7 +14,7 @@ describe('test optimization startup', () => { let sandbox, cwd, receiver, childProcess, processOutput before(async () => { - sandbox = await createSandbox(packageManagers, true) + sandbox = await isolatedSandbox(packageManagers, true) cwd = sandbox.folder }) diff --git a/integration-tests/ci-visibility/test-optimization-wrong-init.spec.js b/integration-tests/ci-visibility/test-optimization-wrong-init.spec.js index f2de4217b35..cbdd0edb733 100644 --- a/integration-tests/ci-visibility/test-optimization-wrong-init.spec.js +++ b/integration-tests/ci-visibility/test-optimization-wrong-init.spec.js @@ -4,7 +4,7 @@ const { once } = require('node:events') const assert = require('node:assert') const { exec } = require('child_process') -const { createSandbox, getCiVisAgentlessConfig } = require('../helpers') +const { isolatedSandbox, getCiVisAgentlessConfig } = require('../helpers') const { FakeCiVisIntake } = require('../ci-visibility-intake') const { NODE_MAJOR } = require('../../version') @@ -55,7 +55,7 @@ testFrameworks.forEach(({ testFramework, command, expectedOutput, extraTestConte testFrameworks.push('@cucumber/cucumber') } - sandbox = await createSandbox(testFrameworks, true) + sandbox = await isolatedSandbox(testFrameworks, true) cwd = sandbox.folder }) diff --git a/integration-tests/code-origin.spec.js b/integration-tests/code-origin.spec.js index 4853b0f9fb8..2e7154d7ab1 100644 --- a/integration-tests/code-origin.spec.js +++ b/integration-tests/code-origin.spec.js @@ -3,13 +3,13 @@ const assert = require('node:assert') const path = require('node:path') const Axios = require('axios') -const { FakeAgent, spawnProc, createSandbox } = require('./helpers') +const { FakeAgent, spawnProc, isolatedSandbox } = require('./helpers') describe('Code Origin for Spans', function () { let sandbox, cwd, appFile, agent, proc, axios before(async () => { - sandbox = await createSandbox(['fastify']) + sandbox = await isolatedSandbox(['fastify']) cwd = sandbox.folder appFile = path.join(cwd, 'code-origin', 'typescript.js') }) diff --git a/integration-tests/cucumber/cucumber.spec.js b/integration-tests/cucumber/cucumber.spec.js index eb3a48b9b88..45ec6da256c 100644 --- a/integration-tests/cucumber/cucumber.spec.js +++ b/integration-tests/cucumber/cucumber.spec.js @@ -8,7 +8,7 @@ const fs = require('fs') const path = require('path') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig, getCiVisEvpProxyConfig } = require('../helpers') @@ -86,7 +86,7 @@ versions.forEach(version => { // add an explicit timeout to make tests less flaky this.timeout(50000) - sandbox = await createSandbox([`@cucumber/cucumber@${version}`, 'assert', 'nyc'], true) + sandbox = await isolatedSandbox([`@cucumber/cucumber@${version}`, 'assert', 'nyc'], true) cwd = sandbox.folder }) diff --git a/integration-tests/cypress/cypress.spec.js b/integration-tests/cypress/cypress.spec.js index 660d736b842..3690573d0bf 100644 --- a/integration-tests/cypress/cypress.spec.js +++ b/integration-tests/cypress/cypress.spec.js @@ -11,7 +11,7 @@ const execPromise = promisify(exec) const { assert } = require('chai') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig, getCiVisEvpProxyConfig } = require('../helpers') @@ -130,7 +130,7 @@ moduleTypes.forEach(({ before(async () => { // cypress-fail-fast is required as an incompatible plugin - sandbox = await createSandbox([`cypress@${version}`, 'cypress-fail-fast@7.1.0'], true) + sandbox = await isolatedSandbox([`cypress@${version}`, 'cypress-fail-fast@7.1.0'], true) cwd = sandbox.folder const { NODE_OPTIONS, ...restOfEnv } = process.env diff --git a/integration-tests/debugger/re-evaluation.spec.js b/integration-tests/debugger/re-evaluation.spec.js index 00378c16dd1..edd72f2669d 100644 --- a/integration-tests/debugger/re-evaluation.spec.js +++ b/integration-tests/debugger/re-evaluation.spec.js @@ -5,7 +5,7 @@ const assert = require('node:assert') const Axios = require('axios') -const { createSandbox, FakeAgent, assertObjectContains, spawnProc } = require('../helpers') +const { isolatedSandbox, FakeAgent, assertObjectContains, spawnProc } = require('../helpers') const { generateProbeConfig } = require('../../packages/dd-trace/test/debugger/devtools_client/utils') // A race condition exists where the tracer receives a probe via RC, before Node.js has had a chance to load all the JS @@ -28,7 +28,7 @@ describe('Dynamic Instrumentation Probe Re-Evaluation', function () { let sandbox before(async function () { - sandbox = await createSandbox( + sandbox = await isolatedSandbox( undefined, undefined, // Ensure the test scripts live in the root of the sandbox so they are always the shortest path when diff --git a/integration-tests/debugger/utils.js b/integration-tests/debugger/utils.js index abf3f2ef848..7b57bffae8b 100644 --- a/integration-tests/debugger/utils.js +++ b/integration-tests/debugger/utils.js @@ -6,7 +6,7 @@ const { randomUUID } = require('crypto') const Axios = require('axios') -const { createSandbox, FakeAgent, spawnProc } = require('../helpers') +const { isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') const { generateProbeConfig } = require('../../packages/dd-trace/test/debugger/devtools_client/utils') const BREAKPOINT_TOKEN = '// BREAKPOINT' @@ -75,7 +75,7 @@ function setup ({ env, testApp, testAppSource, dependencies, silent, stdioHandle } before(async function () { - sandbox = await createSandbox(dependencies) + sandbox = await isolatedSandbox(dependencies) cwd = sandbox.folder // The sandbox uses the `integration-tests` folder as its root t.appFile = join(cwd, 'debugger', breakpoints[0].deployedFile) diff --git a/integration-tests/helpers/index.js b/integration-tests/helpers/index.js index d4ecca0ff52..7701f30626e 100644 --- a/integration-tests/helpers/index.js +++ b/integration-tests/helpers/index.js @@ -680,7 +680,6 @@ module.exports = { telemetryForwarder, assertTelemetryPoints, runAndCheckWithTelemetry, - createSandbox, curl, curlAndAssertMessage, getCiVisAgentlessConfig, diff --git a/integration-tests/jest/jest.spec.js b/integration-tests/jest/jest.spec.js index 6e66fe19ddf..6ee46771f96 100644 --- a/integration-tests/jest/jest.spec.js +++ b/integration-tests/jest/jest.spec.js @@ -8,7 +8,7 @@ const fs = require('fs') const { assert } = require('chai') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig, getCiVisEvpProxyConfig } = require('../helpers') @@ -83,7 +83,7 @@ describe('jest CommonJS', () => { let testOutput = '' before(async function () { - sandbox = await createSandbox([ + sandbox = await isolatedSandbox([ 'jest', 'chai@v4', 'jest-jasmine2', diff --git a/integration-tests/log_injection.spec.js b/integration-tests/log_injection.spec.js index 5553e00bea7..b3751d63215 100644 --- a/integration-tests/log_injection.spec.js +++ b/integration-tests/log_injection.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { FakeAgent, createSandbox, spawnProc, curlAndAssertMessage, assertObjectContains } = require('./helpers') +const { FakeAgent, isolatedSandbox, spawnProc, curlAndAssertMessage, assertObjectContains } = require('./helpers') const path = require('path') const { USER_KEEP } = require('../ext/priority') @@ -13,7 +13,7 @@ describe('Log Injection', () => { let env before(async () => { - sandbox = await createSandbox(['express', 'winston']) + sandbox = await isolatedSandbox(['express', 'winston']) cwd = sandbox.folder app = path.join(cwd, 'log_injection/index.js') }) diff --git a/integration-tests/mocha/mocha.spec.js b/integration-tests/mocha/mocha.spec.js index 59331b4bdd9..6c2f442395a 100644 --- a/integration-tests/mocha/mocha.spec.js +++ b/integration-tests/mocha/mocha.spec.js @@ -8,7 +8,7 @@ const fs = require('fs') const { assert } = require('chai') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig, getCiVisEvpProxyConfig } = require('../helpers') @@ -95,7 +95,7 @@ describe(`mocha@${MOCHA_VERSION}`, function () { let testOutput = '' before(async function () { - sandbox = await createSandbox( + sandbox = await isolatedSandbox( [ `mocha@${MOCHA_VERSION}`, 'chai@v4', diff --git a/integration-tests/openfeature/openfeature-exposure-events.spec.js b/integration-tests/openfeature/openfeature-exposure-events.spec.js index 094f121ceec..de7920bfc3d 100644 --- a/integration-tests/openfeature/openfeature-exposure-events.spec.js +++ b/integration-tests/openfeature/openfeature-exposure-events.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { createSandbox, FakeAgent, spawnProc } = require('../helpers') +const { isolatedSandbox, FakeAgent, spawnProc } = require('../helpers') const path = require('path') const { assert } = require('chai') const { UNACKNOWLEDGED, ACKNOWLEDGED } = require('../../packages/dd-trace/src/remote_config/apply_states') @@ -38,7 +38,7 @@ describe('OpenFeature Remote Config and Exposure Events Integration', () => { '@openfeature/core', ] - sandbox = await createSandbox( + sandbox = await isolatedSandbox( dependencies, false, [path.join(__dirname, 'app')] diff --git a/integration-tests/opentelemetry-logs.spec.js b/integration-tests/opentelemetry-logs.spec.js index c9b95310a36..508b8783e66 100644 --- a/integration-tests/opentelemetry-logs.spec.js +++ b/integration-tests/opentelemetry-logs.spec.js @@ -1,14 +1,14 @@ 'use strict' const { assert } = require('chai') -const { createSandbox } = require('./helpers') +const { isolatedSandbox } = require('./helpers') const http = require('http') describe('OpenTelemetry Logs Integration', () => { let sandbox beforeEach(async () => { - sandbox = await createSandbox() + sandbox = await isolatedSandbox() }) afterEach(async () => { diff --git a/integration-tests/opentelemetry.spec.js b/integration-tests/opentelemetry.spec.js index 055e4b0d4b8..5ac4206ce4c 100644 --- a/integration-tests/opentelemetry.spec.js +++ b/integration-tests/opentelemetry.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { FakeAgent, createSandbox } = require('./helpers') +const { FakeAgent, isolatedSandbox } = require('./helpers') const { fork } = require('child_process') const { join } = require('path') const { assert } = require('chai') @@ -67,7 +67,7 @@ describe('opentelemetry', () => { // Needed because sdk-node doesn't start a tracer without an exporter '@opentelemetry/exporter-jaeger' ] - sandbox = await createSandbox(dependencies) + sandbox = await isolatedSandbox(dependencies) cwd = sandbox.folder agent = await new FakeAgent().start() }) diff --git a/integration-tests/pino.spec.js b/integration-tests/pino.spec.js index 171db3b930b..8990119d2e7 100644 --- a/integration-tests/pino.spec.js +++ b/integration-tests/pino.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { FakeAgent, spawnProc, createSandbox, curl, assertObjectContains } = require('./helpers') +const { FakeAgent, spawnProc, isolatedSandbox, curl, assertObjectContains } = require('./helpers') const path = require('path') const { assert } = require('chai') const { once } = require('events') @@ -13,7 +13,7 @@ describe('pino test', () => { let startupTestFile before(async () => { - sandbox = await createSandbox(['pino']) + sandbox = await isolatedSandbox(['pino']) cwd = sandbox.folder startupTestFile = path.join(cwd, 'pino/index.js') }) diff --git a/integration-tests/playwright/playwright.spec.js b/integration-tests/playwright/playwright.spec.js index 0b883b47527..870039607f5 100644 --- a/integration-tests/playwright/playwright.spec.js +++ b/integration-tests/playwright/playwright.spec.js @@ -9,7 +9,7 @@ const fs = require('fs') const { assert } = require('chai') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig, getCiVisEvpProxyConfig } = require('../helpers') @@ -82,7 +82,7 @@ versions.forEach((version) => { before(async function () { // Usually takes under 30 seconds but sometimes the server is really slow. this.timeout(300_000) - sandbox = await createSandbox([`@playwright/test@${version}`, 'typescript'], true) + sandbox = await isolatedSandbox([`@playwright/test@${version}`, 'typescript'], true) cwd = sandbox.folder const { NODE_OPTIONS, ...restOfEnv } = process.env // Install chromium (configured in integration-tests/playwright.config.js) diff --git a/integration-tests/profiler/profiler.spec.js b/integration-tests/profiler/profiler.spec.js index a3a02d69806..6100957f490 100644 --- a/integration-tests/profiler/profiler.spec.js +++ b/integration-tests/profiler/profiler.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - createSandbox + isolatedSandbox } = require('../helpers') const childProcess = require('child_process') const { fork } = childProcess @@ -310,7 +310,7 @@ describe('profiler', () => { const maxBusyCycleTimeNs = (timeout - 1000) * 1000000 / expectedSpans before(async () => { - sandbox = await createSandbox() + sandbox = await isolatedSandbox() cwd = sandbox.folder profilerTestFile = path.join(cwd, 'profiler/index.js') ssiTestFile = path.join(cwd, 'profiler/ssi.js') diff --git a/integration-tests/remote_config.spec.js b/integration-tests/remote_config.spec.js index 5d1a0e3f6e7..0c55598b4db 100644 --- a/integration-tests/remote_config.spec.js +++ b/integration-tests/remote_config.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { createSandbox, FakeAgent, spawnProc } = require('./helpers') +const { isolatedSandbox, FakeAgent, spawnProc } = require('./helpers') const path = require('path') const Axios = require('axios') const { assert } = require('chai') @@ -11,7 +11,7 @@ describe('Remote config client id', () => { before(async function () { this.timeout(process.platform === 'win32' ? 90000 : 30000) - sandbox = await createSandbox( + sandbox = await isolatedSandbox( ['express'], false, [path.join(__dirname, 'remote_config')] diff --git a/integration-tests/selenium/selenium.spec.js b/integration-tests/selenium/selenium.spec.js index b19aa2eb6ad..5a575a711e0 100644 --- a/integration-tests/selenium/selenium.spec.js +++ b/integration-tests/selenium/selenium.spec.js @@ -5,7 +5,7 @@ const { exec } = require('child_process') const { assert } = require('chai') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig } = require('../helpers') const { FakeCiVisIntake } = require('../ci-visibility-intake') @@ -32,7 +32,7 @@ versionRange.forEach(version => { let webAppPort before(async function () { - sandbox = await createSandbox([ + sandbox = await isolatedSandbox([ 'mocha', 'jest', '@cucumber/cucumber', diff --git a/integration-tests/startup.spec.js b/integration-tests/startup.spec.js index ef3c6022e90..3c9002fe862 100644 --- a/integration-tests/startup.spec.js +++ b/integration-tests/startup.spec.js @@ -3,7 +3,7 @@ const { FakeAgent, spawnProc, - createSandbox, + isolatedSandbox, curlAndAssertMessage } = require('./helpers') const path = require('path') @@ -37,7 +37,7 @@ execArgvs.forEach(({ execArgv, skip }) => { let startupTestFile before(async () => { - sandbox = await createSandbox() + sandbox = await isolatedSandbox() cwd = sandbox.folder startupTestFile = path.join(cwd, 'startup/index.js') }) diff --git a/integration-tests/telemetry.spec.js b/integration-tests/telemetry.spec.js index 4f48f6db73b..c923d48c8fc 100644 --- a/integration-tests/telemetry.spec.js +++ b/integration-tests/telemetry.spec.js @@ -5,7 +5,7 @@ const { describe, before, after, it, beforeEach, afterEach } = require('mocha') const path = require('node:path') -const { createSandbox, FakeAgent, spawnProc, assertObjectContains } = require('./helpers') +const { isolatedSandbox, FakeAgent, spawnProc, assertObjectContains } = require('./helpers') describe('telemetry', () => { describe('dependencies', () => { @@ -16,7 +16,7 @@ describe('telemetry', () => { let proc before(async () => { - sandbox = await createSandbox() + sandbox = await isolatedSandbox() cwd = sandbox.folder startupTestFile = path.join(cwd, 'startup/index.js') }) diff --git a/integration-tests/vitest/vitest.spec.js b/integration-tests/vitest/vitest.spec.js index 07b4482f96b..d59366f33a6 100644 --- a/integration-tests/vitest/vitest.spec.js +++ b/integration-tests/vitest/vitest.spec.js @@ -8,7 +8,7 @@ const fs = require('fs') const { assert } = require('chai') const { - createSandbox, + isolatedSandbox, getCiVisAgentlessConfig } = require('../helpers') const { FakeCiVisIntake } = require('../ci-visibility-intake') @@ -65,7 +65,7 @@ versions.forEach((version) => { let sandbox, cwd, receiver, childProcess, testOutput before(async function () { - sandbox = await createSandbox([ + sandbox = await isolatedSandbox([ `vitest@${version}`, `@vitest/coverage-istanbul@${version}`, `@vitest/coverage-v8@${version}`, diff --git a/packages/dd-trace/test/appsec/iast/code_injection.integration.spec.js b/packages/dd-trace/test/appsec/iast/code_injection.integration.spec.js index abf5dbbf996..6c0f95577ea 100644 --- a/packages/dd-trace/test/appsec/iast/code_injection.integration.spec.js +++ b/packages/dd-trace/test/appsec/iast/code_injection.integration.spec.js @@ -3,7 +3,7 @@ const path = require('path') const Axios = require('axios') const { assert } = require('chai') -const { createSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') +const { linkedSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') describe('IAST - code_injection - integration', () => { let axios, sandbox, cwd, agent, proc @@ -11,7 +11,7 @@ describe('IAST - code_injection - integration', () => { before(async function () { this.timeout(process.platform === 'win32' ? 300000 : 30000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( ['express'], false, [path.join(__dirname, 'resources')] diff --git a/packages/dd-trace/test/appsec/iast/overhead-controller.integration.spec.js b/packages/dd-trace/test/appsec/iast/overhead-controller.integration.spec.js index 3d86b5edb4a..dd4074d0cd6 100644 --- a/packages/dd-trace/test/appsec/iast/overhead-controller.integration.spec.js +++ b/packages/dd-trace/test/appsec/iast/overhead-controller.integration.spec.js @@ -3,7 +3,7 @@ const path = require('path') const Axios = require('axios') const { assert } = require('chai') -const { createSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') +const { linkedSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') describe('IAST - overhead-controller - integration', () => { let axios, sandbox, cwd, agent, proc @@ -11,7 +11,7 @@ describe('IAST - overhead-controller - integration', () => { before(async function () { this.timeout(process.platform === 'win32' ? 300000 : 30000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( ['express'], false, [path.join(__dirname, 'resources')] diff --git a/packages/dd-trace/test/appsec/rasp/command_injection.integration.spec.js b/packages/dd-trace/test/appsec/rasp/command_injection.integration.spec.js index 68d85cd6209..05cc46934f3 100644 --- a/packages/dd-trace/test/appsec/rasp/command_injection.integration.spec.js +++ b/packages/dd-trace/test/appsec/rasp/command_injection.integration.spec.js @@ -5,7 +5,7 @@ const { describe, it, before, beforeEach, afterEach, after } = require('mocha') const path = require('node:path') -const { createSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') +const { linkedSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') describe('RASP - command_injection - integration', () => { let axios, sandbox, cwd, appFile, agent, proc @@ -13,7 +13,7 @@ describe('RASP - command_injection - integration', () => { before(async function () { this.timeout(process.platform === 'win32' ? 90000 : 30000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( ['express'], false, [path.join(__dirname, 'resources')] diff --git a/packages/dd-trace/test/appsec/rasp/lfi.integration.express.plugin.spec.js b/packages/dd-trace/test/appsec/rasp/lfi.integration.express.plugin.spec.js index 679542ac151..8c4ec378cd7 100644 --- a/packages/dd-trace/test/appsec/rasp/lfi.integration.express.plugin.spec.js +++ b/packages/dd-trace/test/appsec/rasp/lfi.integration.express.plugin.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { createSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') +const { linkedSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') const path = require('path') const Axios = require('axios') const { assert } = require('chai') @@ -10,7 +10,7 @@ describe('RASP - lfi - integration - sync', () => { before(async function () { this.timeout(60000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( ['express', 'fs'], false, [path.join(__dirname, 'resources')]) diff --git a/packages/dd-trace/test/appsec/rasp/rasp-metrics.integration.spec.js b/packages/dd-trace/test/appsec/rasp/rasp-metrics.integration.spec.js index d796d4d5852..61733783e74 100644 --- a/packages/dd-trace/test/appsec/rasp/rasp-metrics.integration.spec.js +++ b/packages/dd-trace/test/appsec/rasp/rasp-metrics.integration.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { createSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') +const { linkedSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') const path = require('path') const Axios = require('axios') const { assert } = require('chai') @@ -11,7 +11,7 @@ describe('RASP metrics', () => { before(async function () { this.timeout(process.platform === 'win32' ? 90000 : 30000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( ['express'], false, [path.join(__dirname, 'resources')] diff --git a/packages/dd-trace/test/appsec/rasp/sql_injection.integration.pg.plugin.spec.js b/packages/dd-trace/test/appsec/rasp/sql_injection.integration.pg.plugin.spec.js index ac4e908b714..7b6599ed5ec 100644 --- a/packages/dd-trace/test/appsec/rasp/sql_injection.integration.pg.plugin.spec.js +++ b/packages/dd-trace/test/appsec/rasp/sql_injection.integration.pg.plugin.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { createSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') +const { linkedSandbox, FakeAgent, spawnProc } = require('../../../../../integration-tests/helpers') const path = require('path') const Axios = require('axios') const { assert } = require('chai') @@ -12,7 +12,7 @@ describe('RASP - sql_injection - integration', () => { before(async function () { this.timeout(60000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( ['express', 'pg'], false, [path.join(__dirname, 'resources')]) diff --git a/packages/dd-trace/test/appsec/waf-metrics.integration.spec.js b/packages/dd-trace/test/appsec/waf-metrics.integration.spec.js index a95f6f0d8d6..4db7e84bbdb 100644 --- a/packages/dd-trace/test/appsec/waf-metrics.integration.spec.js +++ b/packages/dd-trace/test/appsec/waf-metrics.integration.spec.js @@ -1,6 +1,6 @@ 'use strict' -const { createSandbox, FakeAgent, spawnProc } = require('../../../../integration-tests/helpers') +const { linkedSandbox, FakeAgent, spawnProc } = require('../../../../integration-tests/helpers') const path = require('path') const Axios = require('axios') const { assert } = require('chai') @@ -11,7 +11,7 @@ describe('WAF Metrics', () => { before(async function () { this.timeout(process.platform === 'win32' ? 90000 : 30000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( ['express'], false, [path.join(__dirname, 'resources')] diff --git a/packages/dd-trace/test/exporters/common/request.spec.js b/packages/dd-trace/test/exporters/common/request.spec.js index abcc1f433f4..913185bf1dc 100644 --- a/packages/dd-trace/test/exporters/common/request.spec.js +++ b/packages/dd-trace/test/exporters/common/request.spec.js @@ -311,7 +311,7 @@ describe('request', function () { }) it('should calculate correct Content-Length header for multi-byte characters', (done) => { - const sandbox = sinon.createSandbox() + const sandbox = sinon.linkedSandbox() sandbox.spy(http, 'request') const body = 'æøå' @@ -341,7 +341,7 @@ describe('request', function () { }) describe('when intercepting http', () => { - const sandbox = sinon.createSandbox() + const sandbox = sinon.linkedSandbox() beforeEach(() => { sandbox.spy(http, 'request') diff --git a/packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js b/packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js index 4e5abc4684d..dd7322a827d 100644 --- a/packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js +++ b/packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js @@ -7,7 +7,7 @@ const { execSync } = require('node:child_process') const { FakeAgent, - createSandbox, + linkedSandbox, spawnProc } = require('../../../../../../integration-tests/helpers') const { expectedLLMObsNonLLMSpanEvent, deepEqualWithMockValues } = require('../../util') @@ -83,7 +83,7 @@ describe('typescript', () => { context(`with version ${version}`, () => { before(async function () { this.timeout(20000) - sandbox = await createSandbox( + sandbox = await linkedSandbox( [`typescript@${version}`], false, ['./packages/dd-trace/test/llmobs/sdk/typescript/*'] ) }) From 70b7e12fd7203b34417d49282387101114743e9b Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 13:13:27 -0400 Subject: [PATCH 06/12] fix sinon sandbox --- packages/dd-trace/test/exporters/common/request.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dd-trace/test/exporters/common/request.spec.js b/packages/dd-trace/test/exporters/common/request.spec.js index 913185bf1dc..abcc1f433f4 100644 --- a/packages/dd-trace/test/exporters/common/request.spec.js +++ b/packages/dd-trace/test/exporters/common/request.spec.js @@ -311,7 +311,7 @@ describe('request', function () { }) it('should calculate correct Content-Length header for multi-byte characters', (done) => { - const sandbox = sinon.linkedSandbox() + const sandbox = sinon.createSandbox() sandbox.spy(http, 'request') const body = 'æøå' @@ -341,7 +341,7 @@ describe('request', function () { }) describe('when intercepting http', () => { - const sandbox = sinon.linkedSandbox() + const sandbox = sinon.createSandbox() beforeEach(() => { sandbox.spy(http, 'request') From 56b33af8dbe7c365fa93b8114de95b2b729599dd Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 13:13:50 -0400 Subject: [PATCH 07/12] add jsdoc --- integration-tests/helpers/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/integration-tests/helpers/index.js b/integration-tests/helpers/index.js index 7701f30626e..97b0aae160a 100644 --- a/integration-tests/helpers/index.js +++ b/integration-tests/helpers/index.js @@ -236,10 +236,22 @@ function execHelper (command, options) { /* eslint-enable no-console */ } +/** + * @param {string[]} dependencies + * @param {boolean} isGitRepo + * @param {string[]} integrationTestsPaths + * @param {string} [followUpCommand] + */ async function isolatedSandbox (dependencies, isGitRepo, integrationTestsPaths, followUpCommand) { return createSandbox(dependencies, isGitRepo, integrationTestsPaths, followUpCommand, true) } +/** + * @param {string[]} dependencies + * @param {boolean} isGitRepo + * @param {string[]} integrationTestsPaths + * @param {string} [followUpCommand] + */ async function linkedSandbox (dependencies, isGitRepo, integrationTestsPaths, followUpCommand) { return createSandbox(dependencies, isGitRepo, integrationTestsPaths, followUpCommand, false) } From 9056616bdc0a7e24726a272e874fe4b5c7d3075d Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 13:52:09 -0400 Subject: [PATCH 08/12] fix cookie-parser test --- .../test/integration-test/client.spec.js | 2 +- packages/dd-trace/test/plugins/versions/package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js b/packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js index cf533b06539..ee122c84b57 100644 --- a/packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js @@ -13,7 +13,7 @@ withVersions('cookie-parser', 'cookie-parser', version => { before(async function () { this.timeout(50000) - sandbox = await linkedSandbox([`'cookie-parser@${version}'`, 'express'], false, + sandbox = await linkedSandbox([`'cookie-parser@${version}'`, 'dc-polyfill', 'express'], false, ['./packages/datadog-plugin-cookie-parser/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', 'cookie-parser', 'cookieParser') }) diff --git a/packages/dd-trace/test/plugins/versions/package.json b/packages/dd-trace/test/plugins/versions/package.json index c1b5ae77843..cd4510ae519 100644 --- a/packages/dd-trace/test/plugins/versions/package.json +++ b/packages/dd-trace/test/plugins/versions/package.json @@ -93,6 +93,7 @@ "couchbase": "4.6.0", "cypress": "15.4.0", "cypress-fail-fast": "7.1.1", + "dc-polyfill": "0.1.10", "dd-trace-api": "1.0.0", "ejs": "3.1.10", "elasticsearch": "16.7.3", From 41e7c1286ead5eaf7609076d0d87e98b5d817626 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 13:53:37 -0400 Subject: [PATCH 09/12] add missing flags --- integration-tests/helpers/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/helpers/index.js b/integration-tests/helpers/index.js index 97b0aae160a..14aa4e2f96e 100644 --- a/integration-tests/helpers/index.js +++ b/integration-tests/helpers/index.js @@ -303,11 +303,11 @@ async function createSandbox (dependencies = [], isGitRepo = false, if (isolated) { execHelper(`npm pack --silent --pack-destination ${folder}`, { env: restOfEnv }) - execHelper(`yarn add ${deps.concat(`file:${out}`).join(' ')}`, addOptions) + execHelper(`yarn add ${deps.concat(`file:${out}`).join(' ')} ${addFlags.join(' ')}`, addOptions) } else { execHelper('yarn link') if (deps.length > 0) { - execHelper(`yarn add ${deps.join(' ')}`, addOptions) + execHelper(`yarn add ${deps.join(' ')} ${addFlags.join(' ')}`, addOptions) } execHelper('yarn link dd-trace', addOptions) } From bec8ad0d41c79ccefe27001ac0d12cdb976a3576 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 13:54:36 -0400 Subject: [PATCH 10/12] add missing dc-polyfill to langchain --- .../test/integration-test/client.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/datadog-plugin-langchain/test/integration-test/client.spec.js b/packages/datadog-plugin-langchain/test/integration-test/client.spec.js index 1ab5488698c..88939fb01d3 100644 --- a/packages/datadog-plugin-langchain/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-langchain/test/integration-test/client.spec.js @@ -20,6 +20,7 @@ describe('esm', () => { sandbox = await linkedSandbox([ `@langchain/core@${version}`, `@langchain/openai@${version}`, + 'dc-polyfill', 'nock' ], false, [ './packages/datadog-plugin-langchain/test/integration-test/*' From 32b1031b46f4b44bb4e5048075a812cee0961bc6 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 14:23:55 -0400 Subject: [PATCH 11/12] fix llmobs sdk --- packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js | 2 +- packages/dd-trace/test/plugins/versions/package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js b/packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js index dd7322a827d..e793260a0f6 100644 --- a/packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js +++ b/packages/dd-trace/test/llmobs/sdk/typescript/index.spec.js @@ -84,7 +84,7 @@ describe('typescript', () => { before(async function () { this.timeout(20000) sandbox = await linkedSandbox( - [`typescript@${version}`], false, ['./packages/dd-trace/test/llmobs/sdk/typescript/*'] + [`typescript@${version}`, '@types/node'], false, ['./packages/dd-trace/test/llmobs/sdk/typescript/*'] ) }) diff --git a/packages/dd-trace/test/plugins/versions/package.json b/packages/dd-trace/test/plugins/versions/package.json index cd4510ae519..a0c21c70b23 100644 --- a/packages/dd-trace/test/plugins/versions/package.json +++ b/packages/dd-trace/test/plugins/versions/package.json @@ -66,6 +66,7 @@ "@prisma/client": "6.17.1", "@redis/client": "5.8.3", "@smithy/smithy-client": "4.9.0", + "@types/node": "18.19.130", "@vitest/coverage-istanbul": "3.2.4", "@vitest/coverage-v8": "3.2.4", "@vitest/runner": "3.2.4", From 5eb5b68444c4c87efe595c8935ed66464bf2181f Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 23 Oct 2025 14:37:20 -0400 Subject: [PATCH 12/12] switch to isolated sandbox for pg --- .../datadog-plugin-pg/test/integration-test/client.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/datadog-plugin-pg/test/integration-test/client.spec.js b/packages/datadog-plugin-pg/test/integration-test/client.spec.js index d530adeabb8..d5b4600899f 100644 --- a/packages/datadog-plugin-pg/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-pg/test/integration-test/client.spec.js @@ -2,7 +2,7 @@ const { FakeAgent, - linkedSandbox, + isolatedSandbox, checkSpansForServiceName, spawnPluginIntegrationTestProc, varySandbox @@ -20,7 +20,8 @@ describe('esm', () => { withVersions('pg', 'pg', (version, _, realVersion) => { before(async function () { this.timeout(60000) - sandbox = await linkedSandbox([`'pg@${version}'`], false, [ + // TODO: Why does using linkedSandbox here make unit tests fail? + sandbox = await isolatedSandbox([`'pg@${version}'`], false, [ './packages/datadog-plugin-pg/test/integration-test/*']) variants = varySandbox(sandbox, 'server.mjs', { default: 'import pg from \'pg\'',