From 06b0e91a48607702b57595298e115a784bbae070 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Wed, 25 Feb 2026 08:48:37 +0100 Subject: [PATCH 1/5] chore: testing --- currencies.json | 2 +- .../{package.json.template => package.json.template.v16} | 0 .../currencies/protocols/graphql/package.json.template.v17 | 7 +++++++ 3 files changed, 8 insertions(+), 1 deletion(-) rename packages/collector/test/integration/currencies/protocols/graphql/{package.json.template => package.json.template.v16} (100%) create mode 100644 packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v17 diff --git a/currencies.json b/currencies.json index d95e0986e5..9c4f7fa000 100644 --- a/currencies.json +++ b/currencies.json @@ -1324,4 +1324,4 @@ } ] } -] \ No newline at end of file +] diff --git a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v16 similarity index 100% rename from packages/collector/test/integration/currencies/protocols/graphql/package.json.template rename to packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v16 diff --git a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v17 b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v17 new file mode 100644 index 0000000000..e5c7d63324 --- /dev/null +++ b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v17 @@ -0,0 +1,7 @@ +{ + "dependencies": { + "amqplib": "latest", + "pino": "latest", + "ws": "latest" + } +} From fa9c868ee2e7e82b605b67b0c61acde8c408b533 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Tue, 24 Feb 2026 12:46:19 +0100 Subject: [PATCH 2/5] chore: cleanup --- .../{package.json.template.v17 => package.json.template} | 0 .../protocols/graphql/package.json.template.v16 | 8 -------- 2 files changed, 8 deletions(-) rename packages/collector/test/integration/currencies/protocols/graphql/{package.json.template.v17 => package.json.template} (100%) delete mode 100644 packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v16 diff --git a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v17 b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template similarity index 100% rename from packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v17 rename to packages/collector/test/integration/currencies/protocols/graphql/package.json.template diff --git a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v16 b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v16 deleted file mode 100644 index 4561bf0d4b..0000000000 --- a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template.v16 +++ /dev/null @@ -1,8 +0,0 @@ -{ - "dependencies": { - "@apollo/server": "latest", - "@as-integrations/express5": "latest", - "amqplib": "latest", - "pino": "latest" - } -} From 4dc16a3ae5e9b1f7084f0ceeaf195560c467ece7 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Tue, 24 Feb 2026 13:05:28 +0100 Subject: [PATCH 3/5] chore: fixes --- bin/create-version-test-folders.js | 2 +- .../currencies/protocols/graphql/modes.json | 1 + .../protocols/graphql/package.json.template | 2 + .../currencies/protocols/graphql/test_base.js | 514 +++++++++--------- 4 files changed, 260 insertions(+), 259 deletions(-) create mode 100644 packages/collector/test/integration/currencies/protocols/graphql/modes.json diff --git a/bin/create-version-test-folders.js b/bin/create-version-test-folders.js index 4e76841e26..544c27f919 100755 --- a/bin/create-version-test-folders.js +++ b/bin/create-version-test-folders.js @@ -232,7 +232,7 @@ mochaSuiteFn(suiteTitle, function () { const npmCmd = process.env.CI ? 'npm install --cache ${rootDir}/.npm-offline-cache --prefer-offline ' + '--no-package-lock --no-audit --prefix ./ --no-progress' : - 'npm install --no-package-lock --no-audit --prefix ./ --no-progress'; + 'npm install --no-package-lock --force --no-audit --prefix ./ --no-progress'; for (let attempt = 0; attempt < maxRetries; attempt++) {${ isOptional diff --git a/packages/collector/test/integration/currencies/protocols/graphql/modes.json b/packages/collector/test/integration/currencies/protocols/graphql/modes.json new file mode 100644 index 0000000000..e33d7cc526 --- /dev/null +++ b/packages/collector/test/integration/currencies/protocols/graphql/modes.json @@ -0,0 +1 @@ +["raw", "apollo"] diff --git a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template index e5c7d63324..44794d0d5e 100644 --- a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template +++ b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template @@ -1,5 +1,7 @@ { "dependencies": { + "@apollo/server": "latest", + "@as-integrations/express5": "latest", "amqplib": "latest", "pino": "latest", "ws": "latest" diff --git a/packages/collector/test/integration/currencies/protocols/graphql/test_base.js b/packages/collector/test/integration/currencies/protocols/graphql/test_base.js index 9477c7b0af..a3da771024 100644 --- a/packages/collector/test/integration/currencies/protocols/graphql/test_base.js +++ b/packages/collector/test/integration/currencies/protocols/graphql/test_base.js @@ -21,7 +21,7 @@ const globalAgent = require('@_local/collector/test/globalAgent'); const agentControls = globalAgent.instance; -module.exports = function (name, version, isLatest) { +module.exports = function (name, version, isLatest, mode) { this.timeout(config.getTestTimeout() * 5); if (!supportedVersion(process.versions.node)) { @@ -33,286 +33,284 @@ module.exports = function (name, version, isLatest) { const useAlias = Math.random >= 0.5; - ['raw', 'apollo'].forEach(type => { - describe(`${type} queries`, function () { - ['amqp', 'http'].forEach(communicationProtocol => { - if (type === 'apollo' && communicationProtocol === 'amqp') { - return it.skip('Test scenario Apollo & AMPQ is not supported.'); - } - - [false, true].forEach(withError => { - [false, true].forEach(queryShorthand => { - // eslint-disable-next-line max-len - const title = `withError: ${withError} queryShorthand: ${queryShorthand} useAlias: ${useAlias} communicationProtocol: ${communicationProtocol}`; - - describe(title, function () { - let serverControls; - let clientControls; - - before(async () => { - serverControls = new ProcessControls({ - dirname: __dirname, - appName: type === 'raw' ? 'rawGraphQLServer.js' : 'apolloServer.js', - useGlobalAgent: true, - env: { - LIBRARY_VERSION: version, - LIBRARY_NAME: name, - LIBRARY_LATEST: isLatest - } - }); - clientControls = new ProcessControls({ - dirname: __dirname, - appName: 'client', - useGlobalAgent: true, - env: { - LIBRARY_VERSION: version, - LIBRARY_NAME: name, - LIBRARY_LATEST: isLatest, - SERVER_PORT: serverControls.getPort() - } - }); - - await serverControls.startAndWaitForAgentConnection(); - await clientControls.startAndWaitForAgentConnection(); + describe(`${mode} queries`, function () { + ['amqp', 'http'].forEach(communicationProtocol => { + if (mode === 'apollo' && communicationProtocol === 'amqp') { + return it.skip('Test scenario Apollo & AMPQ is not supported.'); + } + + [false, true].forEach(withError => { + [false, true].forEach(queryShorthand => { + // eslint-disable-next-line max-len + const title = `withError: ${withError} queryShorthand: ${queryShorthand} useAlias: ${useAlias} communicationProtocol: ${communicationProtocol}`; + + describe(title, function () { + let serverControls; + let clientControls; + + before(async () => { + serverControls = new ProcessControls({ + dirname: __dirname, + appName: mode === 'raw' ? 'rawGraphQLServer.js' : 'apolloServer.js', + useGlobalAgent: true, + env: { + LIBRARY_VERSION: version, + LIBRARY_NAME: name, + LIBRARY_LATEST: isLatest + } }); - - beforeEach(async () => { - await agentControls.clearReceivedTraceData(); + clientControls = new ProcessControls({ + dirname: __dirname, + appName: 'client', + useGlobalAgent: true, + env: { + LIBRARY_VERSION: version, + LIBRARY_NAME: name, + LIBRARY_LATEST: isLatest, + SERVER_PORT: serverControls.getPort() + } }); - after(async () => { - await serverControls.stop(); - await clientControls.stop(); - }); + await serverControls.startAndWaitForAgentConnection(); + await clientControls.startAndWaitForAgentConnection(); + }); - it.skip('must trace a query with a value resolver', () => { - const resolverType = 'value'; - const multipleEntities = null; - - const queryParams = [ - withError ? 'withError=yes' : null, - queryShorthand ? 'queryShorthand=yes' : null, - multipleEntities ? 'multipleEntities=yes' : null, - useAlias ? 'useAlias=yes' : null, - `communicationProtocol=${communicationProtocol}` - ] - .filter(param => !!param) - .join('&'); - - const url = queryParams ? `/${resolverType}?${queryParams}` : `/${resolverType}`; - - return clientControls - .sendRequest({ - method: 'POST', - path: url - }) - .then(response => { - const entityName = withError ? `${resolverType}Error` : resolverType; - const entityNameWithAlias = useAlias ? `${entityName}Alias` : entityName; - - checkQueryResponse(entityNameWithAlias, withError, null, response); - - return retry(() => { - return agentControls.getSpans().then(spans => { - return verifySpansForQuery( - { - resolverType, - entityName, - withError, - queryShorthand, - multipleEntities, - communicationProtocol - }, - spans - ); - }); - }); - }); - }); + beforeEach(async () => { + await agentControls.clearReceivedTraceData(); + }); - it('must trace a query with a promise resolver', () => { - const resolverType = 'promise'; - const multipleEntities = null; - - const queryParams = [ - withError ? 'withError=yes' : null, - queryShorthand ? 'queryShorthand=yes' : null, - multipleEntities ? 'multipleEntities=yes' : null, - useAlias ? 'useAlias=yes' : null, - `communicationProtocol=${communicationProtocol}` - ] - .filter(param => !!param) - .join('&'); - - const url = queryParams ? `/${resolverType}?${queryParams}` : `/${resolverType}`; - - return clientControls - .sendRequest({ - method: 'POST', - path: url - }) - .then(response => { - const entityName = withError ? `${resolverType}Error` : resolverType; - const entityNameWithAlias = useAlias ? `${entityName}Alias` : entityName; - - checkQueryResponse(entityNameWithAlias, withError, null, response); - - return retry(() => - agentControls.getSpans().then( - verifySpansForQuery.bind(null, { - resolverType, - entityName, - withError, - queryShorthand, - multipleEntities, - communicationProtocol - }) - ) - ); - }); - }); + after(async () => { + await serverControls.stop(); + await clientControls.stop(); + }); - it('must trace a query which resolves to an array of promises', () => { - const resolverType = 'array'; - const multipleEntities = null; - - const queryParams = [ - withError ? 'withError=yes' : null, - queryShorthand ? 'queryShorthand=yes' : null, - multipleEntities ? 'multipleEntities=yes' : null, - useAlias ? 'useAlias=yes' : null, - `communicationProtocol=${communicationProtocol}` - ] - .filter(param => !!param) - .join('&'); - - const url = queryParams ? `/${resolverType}?${queryParams}` : `/${resolverType}`; - - return clientControls - .sendRequest({ - method: 'POST', - path: url - }) - .then(response => { - const entityName = withError ? `${resolverType}Error` : resolverType; - const entityNameWithAlias = useAlias ? `${entityName}Alias` : entityName; - - checkQueryResponse(entityNameWithAlias, withError, null, response); - - return retry(() => - agentControls.getSpans().then( - verifySpansForQuery.bind(null, { + it.skip('must trace a query with a value resolver', () => { + const resolverType = 'value'; + const multipleEntities = null; + + const queryParams = [ + withError ? 'withError=yes' : null, + queryShorthand ? 'queryShorthand=yes' : null, + multipleEntities ? 'multipleEntities=yes' : null, + useAlias ? 'useAlias=yes' : null, + `communicationProtocol=${communicationProtocol}` + ] + .filter(param => !!param) + .join('&'); + + const url = queryParams ? `/${resolverType}?${queryParams}` : `/${resolverType}`; + + return clientControls + .sendRequest({ + method: 'POST', + path: url + }) + .then(response => { + const entityName = withError ? `${resolverType}Error` : resolverType; + const entityNameWithAlias = useAlias ? `${entityName}Alias` : entityName; + + checkQueryResponse(entityNameWithAlias, withError, null, response); + + return retry(() => { + return agentControls.getSpans().then(spans => { + return verifySpansForQuery( + { resolverType, entityName, withError, queryShorthand, multipleEntities, communicationProtocol - }) - ) - ); + }, + spans + ); + }); }); - }); + }); + }); - it('must trace a query with multiple entities', () => { - const resolverType = 'array'; - const multipleEntities = true; - - const queryParams = [ - withError ? 'withError=yes' : null, - queryShorthand ? 'queryShorthand=yes' : null, - multipleEntities ? 'multipleEntities=yes' : null, - useAlias ? 'useAlias=yes' : null, - `communicationProtocol=${communicationProtocol}` - ] - .filter(param => !!param) - .join('&'); - - const url = queryParams ? `/${resolverType}?${queryParams}` : `/${resolverType}`; - - return clientControls - .sendRequest({ - method: 'POST', - path: url - }) - .then(response => { - const entityName = withError ? `${resolverType}Error` : resolverType; - const entityNameWithAlias = useAlias ? `${entityName}Alias` : entityName; - - checkQueryResponse(entityNameWithAlias, withError, null, response); - - return retry(() => - agentControls.getSpans().then( - verifySpansForQuery.bind(null, { - resolverType, - entityName, - withError, - queryShorthand, - multipleEntities, - communicationProtocol - }) - ) - ); - }); - }); + it('must trace a query with a promise resolver', () => { + const resolverType = 'promise'; + const multipleEntities = null; + + const queryParams = [ + withError ? 'withError=yes' : null, + queryShorthand ? 'queryShorthand=yes' : null, + multipleEntities ? 'multipleEntities=yes' : null, + useAlias ? 'useAlias=yes' : null, + `communicationProtocol=${communicationProtocol}` + ] + .filter(param => !!param) + .join('&'); + + const url = queryParams ? `/${resolverType}?${queryParams}` : `/${resolverType}`; + + return clientControls + .sendRequest({ + method: 'POST', + path: url + }) + .then(response => { + const entityName = withError ? `${resolverType}Error` : resolverType; + const entityNameWithAlias = useAlias ? `${entityName}Alias` : entityName; + + checkQueryResponse(entityNameWithAlias, withError, null, response); + + return retry(() => + agentControls.getSpans().then( + verifySpansForQuery.bind(null, { + resolverType, + entityName, + withError, + queryShorthand, + multipleEntities, + communicationProtocol + }) + ) + ); + }); + }); + + it('must trace a query which resolves to an array of promises', () => { + const resolverType = 'array'; + const multipleEntities = null; + + const queryParams = [ + withError ? 'withError=yes' : null, + queryShorthand ? 'queryShorthand=yes' : null, + multipleEntities ? 'multipleEntities=yes' : null, + useAlias ? 'useAlias=yes' : null, + `communicationProtocol=${communicationProtocol}` + ] + .filter(param => !!param) + .join('&'); + + const url = queryParams ? `/${resolverType}?${queryParams}` : `/${resolverType}`; + + return clientControls + .sendRequest({ + method: 'POST', + path: url + }) + .then(response => { + const entityName = withError ? `${resolverType}Error` : resolverType; + const entityNameWithAlias = useAlias ? `${entityName}Alias` : entityName; + + checkQueryResponse(entityNameWithAlias, withError, null, response); + + return retry(() => + agentControls.getSpans().then( + verifySpansForQuery.bind(null, { + resolverType, + entityName, + withError, + queryShorthand, + multipleEntities, + communicationProtocol + }) + ) + ); + }); + }); + + it('must trace a query with multiple entities', () => { + const resolverType = 'array'; + const multipleEntities = true; + + const queryParams = [ + withError ? 'withError=yes' : null, + queryShorthand ? 'queryShorthand=yes' : null, + multipleEntities ? 'multipleEntities=yes' : null, + useAlias ? 'useAlias=yes' : null, + `communicationProtocol=${communicationProtocol}` + ] + .filter(param => !!param) + .join('&'); + + const url = queryParams ? `/${resolverType}?${queryParams}` : `/${resolverType}`; + + return clientControls + .sendRequest({ + method: 'POST', + path: url + }) + .then(response => { + const entityName = withError ? `${resolverType}Error` : resolverType; + const entityNameWithAlias = useAlias ? `${entityName}Alias` : entityName; + + checkQueryResponse(entityNameWithAlias, withError, null, response); + + return retry(() => + agentControls.getSpans().then( + verifySpansForQuery.bind(null, { + resolverType, + entityName, + withError, + queryShorthand, + multipleEntities, + communicationProtocol + }) + ) + ); + }); }); }); }); }); + }); - describe(`${type}: mutations`, function () { - let serverControls; - let clientControls; - - before(async () => { - serverControls = new ProcessControls({ - dirname: __dirname, - appName: type === 'raw' ? 'rawGraphQLServer.js' : 'apolloServer.js', - useGlobalAgent: true, - env: { - LIBRARY_VERSION: version, - LIBRARY_NAME: name, - LIBRARY_LATEST: isLatest - } - }); - clientControls = new ProcessControls({ - dirname: __dirname, - appName: 'client', - useGlobalAgent: true, - env: { - LIBRARY_VERSION: version, - LIBRARY_NAME: name, - LIBRARY_LATEST: isLatest, - SERVER_PORT: serverControls.getPort() - } - }); - - await serverControls.startAndWaitForAgentConnection(); - await clientControls.startAndWaitForAgentConnection(); + describe(`${mode}: mutations`, function () { + let serverControls; + let clientControls; + + before(async () => { + serverControls = new ProcessControls({ + dirname: __dirname, + appName: mode === 'raw' ? 'rawGraphQLServer.js' : 'apolloServer.js', + useGlobalAgent: true, + env: { + LIBRARY_VERSION: version, + LIBRARY_NAME: name, + LIBRARY_LATEST: isLatest + } }); - - beforeEach(async () => { - await agentControls.clearReceivedTraceData(); + clientControls = new ProcessControls({ + dirname: __dirname, + appName: 'client', + useGlobalAgent: true, + env: { + LIBRARY_VERSION: version, + LIBRARY_NAME: name, + LIBRARY_LATEST: isLatest, + SERVER_PORT: serverControls.getPort() + } }); - after(async () => { - await serverControls.stop(); - await clientControls.stop(); - }); + await serverControls.startAndWaitForAgentConnection(); + await clientControls.startAndWaitForAgentConnection(); + }); - it('must trace a mutation', () => { - const url = '/mutation'; - - return clientControls - .sendRequest({ - method: 'POST', - path: url - }) - .then(response => { - checkMutationResponse(response); - return retry(() => agentControls.getSpans().then(verifySpansForMutation)); - }); - }); + beforeEach(async () => { + await agentControls.clearReceivedTraceData(); + }); + + after(async () => { + await serverControls.stop(); + await clientControls.stop(); + }); + + it('must trace a mutation', () => { + const url = '/mutation'; + + return clientControls + .sendRequest({ + method: 'POST', + path: url + }) + .then(response => { + checkMutationResponse(response); + return retry(() => agentControls.getSpans().then(verifySpansForMutation)); + }); }); }); }); From 45475e27115c376093bed250109572c1ca0d6d75 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Wed, 25 Feb 2026 08:48:52 +0100 Subject: [PATCH 4/5] chore: tidy uop --- .../currencies/protocols/graphql/package.json.template | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template index 44794d0d5e..4561bf0d4b 100644 --- a/packages/collector/test/integration/currencies/protocols/graphql/package.json.template +++ b/packages/collector/test/integration/currencies/protocols/graphql/package.json.template @@ -3,7 +3,6 @@ "@apollo/server": "latest", "@as-integrations/express5": "latest", "amqplib": "latest", - "pino": "latest", - "ws": "latest" + "pino": "latest" } } From 39d6c23d5e4f98afb29877697baccf20fd67e2b1 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Tue, 24 Feb 2026 13:09:17 +0100 Subject: [PATCH 5/5] chore: cleanup --- bin/create-version-test-folders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/create-version-test-folders.js b/bin/create-version-test-folders.js index 544c27f919..4e76841e26 100755 --- a/bin/create-version-test-folders.js +++ b/bin/create-version-test-folders.js @@ -232,7 +232,7 @@ mochaSuiteFn(suiteTitle, function () { const npmCmd = process.env.CI ? 'npm install --cache ${rootDir}/.npm-offline-cache --prefer-offline ' + '--no-package-lock --no-audit --prefix ./ --no-progress' : - 'npm install --no-package-lock --force --no-audit --prefix ./ --no-progress'; + 'npm install --no-package-lock --no-audit --prefix ./ --no-progress'; for (let attempt = 0; attempt < maxRetries; attempt++) {${ isOptional