diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 30536a10818..89cf65f4351 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -414,8 +414,10 @@ def getSmartTAVContext() { } } else if (params.Run_As_Master_Branch) { context.ghDescription = 'TAV Test param-triggered' + // XXX could change this to look for .tav.yml files under test/instrumentation/modules context.tav = readYaml(file: '.ci/.jenkins_tav.yml') } else if (env.CHANGE_ID && env.TAV_UPDATED != "false") { + // XXX What is this used for? context.ghContextName = 'TAV Test Subset' context.ghDescription = 'TAV Test changes-triggered' sh '.ci/scripts/get_tav.sh .ci/.jenkins_generated_tav.yml' diff --git a/.gitignore b/.gitignore index 7a7f3d2b750..0d5c68d5b15 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /node_modules /test/benchmarks/.tmp /tmp +/test/instrumentation/**/node_modules diff --git a/.tav.yml b/.tav.yml index 3d38f5d6c38..bcbd49abb82 100644 --- a/.tav.yml +++ b/.tav.yml @@ -1,297 +1,3 @@ -generic-pool: - versions: ^2.0.0 || ^3.1.0 - commands: node test/instrumentation/modules/generic-pool.test.js -mimic-response: - versions: ^1.0.0 - commands: - - node test/instrumentation/modules/mimic-response.test.js - - node test/instrumentation/modules/http/github-179.test.js -got-very-old: - name: got - versions: '>=4.0.0 <9.0.0' - node: '>=5' - commands: node test/instrumentation/modules/http/github-423.test.js -got-old: - name: got - versions: ^9.0.0 - node: '>=8.3' - commands: node test/instrumentation/modules/http/github-423.test.js -got-new: - name: got - versions: '>=10.0.0 <10.5.1 || >10.5.1' # v10.5.1 is broken - node: '>=10' - commands: node test/instrumentation/modules/http/github-423.test.js -mysql: - versions: ^2.0.0 - commands: - - node test/instrumentation/modules/mysql/mysql.test.js - - node test/instrumentation/modules/mysql/pool-release-1.test.js -mysql2-old: - name: mysql2 - versions: '>=1.0.0 <1.6.0' - commands: - - node test/instrumentation/modules/mysql2/mysql.test.js - - node test/instrumentation/modules/mysql2/pool-release-1.test.js -mysql2-new: - name: mysql2 - versions: '1.6.0 || 1.6.1 || >=1.6.3 <3' # v1.6.2 is broken: https://github.com/sidorares/node-mysql2/issues/869 - node: '>=6.0.0' - commands: - - node test/instrumentation/modules/mysql2/mysql.test.js - - node test/instrumentation/modules/mysql2/pool-release-1.test.js -redis: - versions: '>=2.0.0 <4.0.0' - commands: node test/instrumentation/modules/redis.test.js -ioredis-old: - name: ioredis - versions: '>=2 <3.1.3 || >3.1.3 <4' # v3.1.3 is broken in older versions of Node because of https://github.com/luin/ioredis/commit/d5867f7c7f03a770a8c0ca5680fdcbfcaf8488e7 - commands: node test/instrumentation/modules/ioredis.test.js -ioredis-new: - name: ioredis - versions: '^4.0.0' - node: '>=6' - commands: node test/instrumentation/modules/ioredis.test.js -pg-old-node: - name: pg - # We want this version range: - # versions: '>=4 <9' - # but only the latest MAJOR.MINOR.x to reduce the test matrix. - # - # Maintenance note: This should be updated for newer MAJOR.MINOR releases. - versions: '4.0.0 || 4.1.1 || 4.2.0 || 4.3.0 || 4.4.6 || 4.5.7 || 5.0.0 || 5.1.0 || 5.2.1 || 6.0.5 || 6.1.6 || 6.2.5 || 6.3.3 || 6.4.2 || 7.0.3 || 7.1.2 || 7.2.0 || 7.3.0 || 7.4.3 || 7.5.0 || 7.6.1 || 7.7.1 || 7.8.2 || 7.9.0 || 7.10.0 || 7.11.0 || 7.12.1 || 7.13.0 || 7.14.0 || 7.15.2 || 7.16.1 || 7.17.1 || 7.18.2 || 8.0.3 || 8.1.0 || 8.2.2 || 8.3.3 || 8.4.2 || 8.5.1 || 8.6.0 || >8.6.0 <9' - node: '<14' - peerDependencies: - - bluebird@^3.0.0 - - knex@^0.17.3 - commands: - - node test/instrumentation/modules/pg/pg.test.js - - node test/instrumentation/modules/pg/knex.test.js -pg-new-node: - name: pg - # We want this version range: - # versions: '>=8.0.3 <9' # Prior versions didn't work in Node.js 14 - # but only the latest MAJOR.MINOR.x to reduce the test matrix. - # - # Maintenance note: This should be updated for newer MAJOR.MINOR releases. - versions: '8.0.3 || 8.1.0 || 8.2.2 || 8.3.3 || 8.4.2 || 8.5.1 || 8.6.0 || >8.6.0 <9' - node: '>=14' - peerDependencies: - - bluebird@^3.0.0 - - knex@^0.17.3 - commands: - - node test/instrumentation/modules/pg/pg.test.js - - node test/instrumentation/modules/pg/knex.test.js -mongodb-core: - versions: '>=1.2.19 <4' - commands: node test/instrumentation/modules/mongodb-core.test.js -mongodb: - versions: '>=3.3' - commands: node test/instrumentation/modules/mongodb.test.js -bluebird: - versions: '>=2 <4' - commands: - - node test/instrumentation/modules/bluebird/bluebird.test.js - - node test/instrumentation/modules/bluebird/cancel.test.js -knex-old: - name: knex - # v0.16.4 accidentally dropped support for Node.js 6 - versions: ^0.16.5 || <0.16.4 >=0.16.0 || ^0.15.0 || ^0.14.0 || ^0.13.0 || ^0.12.5 || <0.12.4 >0.11.6 || <0.11.6 >0.9.0 - commands: node test/instrumentation/modules/pg/knex.test.js -knex-new: - name: knex - node: '>=8.6.0' - versions: '>=0.17 <0.21' - commands: node test/instrumentation/modules/pg/knex.test.js -knex-gt-nodev8: - name: knex - node: '>=10.22.0' - versions: '>=0.21 <0.22' - commands: node test/instrumentation/modules/pg/knex.test.js -ws-old: - name: ws - versions: '>=1 <7' - commands: node test/instrumentation/modules/ws.test.js -ws-new: - name: ws - node: '>=8.6.0' - versions: '>=7 <8' - commands: node test/instrumentation/modules/ws.test.js -graphql: - preinstall: npm uninstall express-graphql - versions: '>=0.7.0 <0.11.0 || >=0.11.1 <16.0.0' - commands: node test/instrumentation/modules/graphql.test.js -express: - versions: '>=4' - commands: - - node test/instrumentation/modules/express/basic.test.js - - node test/instrumentation/modules/express/capture-exceptions-off.test.js - - node test/instrumentation/modules/express/capture-exceptions-on.test.js - - node test/instrumentation/modules/express/set-framework.test.js - -express-graphql-1: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.8.2 - versions: '0.6.1' - commands: node test/instrumentation/modules/express-graphql.test.js - -express-graphql-2: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.9.0 - versions: '>=0.6.2 <0.6.6' - commands: node test/instrumentation/modules/express-graphql.test.js - -express-graphql-3: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.10.0 - versions: '>=0.6.6 <0.6.8' - commands: node test/instrumentation/modules/express-graphql.test.js - -express-graphql-0.6.11_10: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.10.0 - versions: '0.6.11' - commands: node test/instrumentation/modules/express-graphql.test.js -express-graphql-0.6.11_11: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.11.0 - versions: '0.6.11' - commands: node test/instrumentation/modules/express-graphql.test.js - -express-graphql-0.6.12_10: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.10.0 - versions: '^0.6.12' - commands: node test/instrumentation/modules/express-graphql.test.js -express-graphql-0.6.12_11: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.11.0 - versions: '^0.6.12' - commands: node test/instrumentation/modules/express-graphql.test.js -express-graphql-0.6.12_12: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.12.0 - versions: '^0.6.12' - commands: node test/instrumentation/modules/express-graphql.test.js -express-graphql-0.6.12_13: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.13.0 - versions: '^0.6.12' - commands: node test/instrumentation/modules/express-graphql.test.js - -express-graphql-0.7.1_12: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.12.0 - versions: '>=0.7.1 <0.9.0' - commands: node test/instrumentation/modules/express-graphql.test.js -express-graphql-0.7.1_13: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^0.13.0 - versions: '>=0.7.1 <0.9.0' - commands: node test/instrumentation/modules/express-graphql.test.js -express-graphql-0.7.1_14: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^14.0.0 - versions: '>=0.7.1 <0.9.0' - commands: node test/instrumentation/modules/express-graphql.test.js - -express-graphql-0.9.0: - name: express-graphql - preinstall: npm uninstall apollo-server-express - peerDependencies: graphql@^14.4.1 - versions: '>=0.9.0 <0.10.0' - node: '>=7.6.0' - commands: node test/instrumentation/modules/express-graphql.test.js - -apollo-server-express-2_12: - name: apollo-server-express - preinstall: npm uninstall express-graphql - peerDependencies: graphql@^0.12.0 - # We want this version range: - # versions: '>=2.9.16 <2.2 || >= 2.3.2 <3' - # but only the latest MAJOR.MINOR.x to reduce the test matrix. - # - # Maintenance note: This should be updated for newer MAJOR.MINOR releases. - versions: '2.9.16 || 2.10.1 || 2.11.0 || 2.12.0 || 2.13.1 || 2.14.5 || 2.15.1 || 2.16.1 || 2.17.0 || 2.18.2 || 2.19.2 || 2.20.0 || 2.21.2 || 2.22.2 || 2.23.0 || 2.24.1 || 2.25.0 || >2.25.x <3' - node: '>=6' - commands: node test/instrumentation/modules/apollo-server-express.test.js -apollo-server-express-2_13: - name: apollo-server-express - preinstall: npm uninstall express-graphql - peerDependencies: graphql@^0.13.0 - # We want this version range: - # versions: '>=2.9.16 <2.2 || >= 2.3.2 <3' - # but only the latest MAJOR.MINOR.x to reduce the test matrix. - # - # Maintenance note: This should be updated for newer MAJOR.MINOR releases. - versions: '2.9.16 || 2.10.1 || 2.11.0 || 2.12.0 || 2.13.1 || 2.14.5 || 2.15.1 || 2.16.1 || 2.17.0 || 2.18.2 || 2.19.2 || 2.20.0 || 2.21.2 || 2.22.2 || 2.23.0 || 2.24.1 || 2.25.0 || >2.25.x <3' - node: '>=6' - commands: node test/instrumentation/modules/apollo-server-express.test.js -apollo-server-express-2_14: - name: apollo-server-express - preinstall: npm uninstall express-graphql - peerDependencies: graphql@^14.0.0 - # We want this version range: - # versions: '>=2.9.16 <2.2 || >= 2.3.2 <3' - # but only the latest MAJOR.MINOR.x to reduce the test matrix. - # - # Maintenance note: This should be updated for newer MAJOR.MINOR releases. - versions: '2.9.16 || 2.10.1 || 2.11.0 || 2.12.0 || 2.13.1 || 2.14.5 || 2.15.1 || 2.16.1 || 2.17.0 || 2.18.2 || 2.19.2 || 2.20.0 || 2.21.2 || 2.22.2 || 2.23.0 || 2.24.1 || 2.25.0 || >2.25.x <3' - node: '>=6' - commands: node test/instrumentation/modules/apollo-server-express.test.js -apollo-server-express-2_15: - name: apollo-server-express - preinstall: npm uninstall express-graphql - peerDependencies: graphql@^15.0.0 - # We want this version range (2.12.0 was the first release of - # apollo-server-express after graphql@15 was released): - # versions: '>= 2.12.0 <3' - # but only the latest MAJOR.MINOR.x to reduce the test matrix. - # - # Maintenance note: This should be updated for newer MAJOR.MINOR releases. - versions: '2.15.1 || 2.16.1 || 2.17.0 || 2.18.2 || 2.19.2 || 2.20.0 || 2.21.2 || 2.22.2 || 2.23.0 || 2.24.1 || 2.25.0 || >2.25.x <3' - # Per https://github.com/graphql/graphql-js/releases/tag/v15.0.0 - # graphql v15 supports node v8 as a minimum. - node: '>=8' - commands: node test/instrumentation/modules/apollo-server-express.test.js - -apollo-server-express-3_15: - name: apollo-server-express - preinstall: npm uninstall express-graphql - peerDependencies: graphql@^15.0.0 - versions: '^3.0.0' - node: '>=12' - commands: node test/instrumentation/modules/apollo-server-express.test.js - -express-queue: - versions: '>=0.0.11' - commands: node test/instrumentation/modules/express-queue.test.js - -koa-router: - node: '>=6.0.0' - peerDependencies: koa@2 - versions: '>=5.2.0 <11' - commands: node test/instrumentation/modules/koa-router/old-name.test.js -'@koa/router': - node: '>=8.0.0' - peerDependencies: koa@2 - versions: '>=8 <11' - commands: node test/instrumentation/modules/koa-router/new-name.test.js - -elasticsearch: - versions: '>=8.0.0' - commands: node test/instrumentation/modules/elasticsearch.test.js # @elastic/elasticsearch # - Version 7.7.0 included a change that broke usage with Node.js < 10. @@ -315,73 +21,6 @@ elasticsearch: node: '>=12' commands: node test/instrumentation/modules/@elastic/elasticsearch-canary.test.js -handlebars: - versions: '*' - commands: node test/instrumentation/modules/handlebars.test.js -jade: - versions: '>0.5.5' - commands: node test/instrumentation/modules/jade.test.js -pug: - versions: '0.1.0 || >2.0.0' - commands: node test/instrumentation/modules/pug.test.js - -# hapi and @hapi/hapi -# - Package name: Starting with v17.9.0 and v18.2.0 the name changed from -# 'hapi' to '@hapi/hapi'. -# - Node version compat: -# - hapi@15: supports node >=v4; breaks on node v14 (usage of `os.tmpDir()`) -# - hapi@16: supports node >=v4 -# - hapi@17, @hapi/hapi@17: supports node >=v8.12.0 (per its README); -# the instrumentation changed significantly for this version -# - hapi@18, @hapi/hapi@18: supports node >=v8.12.0 (per its README) -# - @hapi/hapi@19: supports node >=v12 (judging from commit 50d8d7d) -# - @hapi/hapi@20: appears (from travis template refs) to support node >=v12 -hapi-v9-v15: - name: hapi - versions: '>=9.0.1 <16.0.0' - node: '>=4 <14' - commands: - - node test/instrumentation/modules/hapi/basic-legacy-path.test.js - - node test/instrumentation/modules/hapi/set-framework-hapi.test.js -hapi-v16: - name: hapi - versions: '>=16.0.0 <17.0.0' - node: '>=4' - commands: - - node test/instrumentation/modules/hapi/basic-legacy-path.test.js - - node test/instrumentation/modules/hapi/set-framework-hapi.test.js -hapi-prenodev15: - name: hapi - versions: '>=17.0.0' - node: '>=8.12.0 <15.0.0' - commands: - - node test/instrumentation/modules/hapi/basic-legacy-path.test.js - - node test/instrumentation/modules/hapi/set-framework-hapi.test.js -hapi: - name: hapi - # Work around https://github.com/npm/cli/issues/2267 in npm@7. - # Note: An alternative might be to just not test the "hapi" package with - # node >= 15, given that "hapi" was deprecated before node v16. - preinstall: rm -rf node_modules/hapi - node: '>=15.0.0' - versions: '>=17.0.0' - commands: - - node test/instrumentation/modules/hapi/basic-legacy-path.test.js - - node test/instrumentation/modules/hapi/set-framework-hapi.test.js -'@hapi/hapi-v17-v18': - name: '@hapi/hapi' - versions: '>=17.0.0 <19.0.0' - node: '>=8.12.0' - commands: - - node test/instrumentation/modules/hapi/basic.test.js - - node test/instrumentation/modules/hapi/set-framework-hapihapi.test.js -'@hapi/hapi': - name: '@hapi/hapi' - versions: '>=19.0.0' - node: '>=12' - commands: - - node test/instrumentation/modules/hapi/basic.test.js - - node test/instrumentation/modules/hapi/set-framework-hapihapi.test.js tedious: name: tedious @@ -395,46 +34,7 @@ cassandra-driver: versions: '>=3 <3.1.0 || >3.1.0 <5' commands: node test/instrumentation/modules/cassandra-driver/index.test.js -restify-old: - name: restify - versions: '>=5.2.0 <8.0.0' - commands: - - node test/instrumentation/modules/restify/basic.test.js - - node test/instrumentation/modules/restify/set-framework.test.js -restify-new: - name: restify - node: '>=8.6.0' - versions: '>=8.0.0' - commands: - - node test/instrumentation/modules/restify/basic.test.js - - node test/instrumentation/modules/restify/set-framework.test.js -# https://www.fastify.io/docs/latest/LTS/ -# - #1086 suggests fastify@2.4.0 was a broken release, skip it. -fastify-v1: - name: fastify - versions: '1.x' - node: '>=6 <12' - commands: - - node test/instrumentation/modules/fastify/fastify.test.js - - node test/instrumentation/modules/fastify/async-await.test.js - - node test/instrumentation/modules/fastify/set-framework.test.js -fastify-v2: - name: fastify - versions: '>=2.0.0 <2.4.0 || >2.4.0 <3' - node: '>=6 <15' - commands: - - node test/instrumentation/modules/fastify/fastify.test.js - - node test/instrumentation/modules/fastify/async-await.test.js - - node test/instrumentation/modules/fastify/set-framework.test.js -fastify: - name: fastify - versions: '>=3.0.0' - node: '>=10' - commands: - - node test/instrumentation/modules/fastify/fastify.test.js - - node test/instrumentation/modules/fastify/async-await.test.js - - node test/instrumentation/modules/fastify/set-framework.test.js finalhandler: versions: '*' diff --git a/package.json b/package.json index 1f8ffa2e92a..09bd60101d2 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,11 @@ "lint": "standard", "lint:fix": "standard --fix", "coverage": "COVERAGE=true ./test/script/run_tests.sh", + "test:prepare": "./test/script/prepare-tests.sh", "test": "./test/script/run_tests.sh", "test:cli": "node test/script/cli.js", - "test:deps": "dependency-check start.js index.js 'lib/**/*.js' 'test/**/*.js' --no-dev -i async_hooks -i perf_hooks -i parseurl", - "test:tav": "tav --quiet", + "test:deps": "dependency-check start.js index.js 'lib/**/*.js' 'test/**/*.js' '!test/instrumentation/modules/**' --no-dev -i async_hooks -i perf_hooks -i parseurl", + "test:tav": "./test/script/tav-in-module-dirs.sh && tav --quiet", "test:docs": "./test/script/docker/run_docs.sh", "test:types": "tsc --project test/types/tsconfig.json && tsc --project test/types/transpile/tsconfig.json && node test/types/transpile/index.js && tsc --project test/types/transpile-default/tsconfig.json && node test/types/transpile-default/index.js", "test:babel": "babel test/babel/src.js --out-file test/babel/out.js && node test/babel/out.js", diff --git a/test/instrumentation/modules/apollo-server-express/.npmrc b/test/instrumentation/modules/apollo-server-express/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/apollo-server-express/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/apollo-server-express/.tav.yml b/test/instrumentation/modules/apollo-server-express/.tav.yml new file mode 100644 index 00000000000..806155f06bd --- /dev/null +++ b/test/instrumentation/modules/apollo-server-express/.tav.yml @@ -0,0 +1,60 @@ +apollo-server-express-2_12: + name: apollo-server-express + #XXX + #preinstall: npm uninstall express-graphql + peerDependencies: graphql@^0.12.0 + # We want this version range: + # versions: '>=2.9.16 <2.2 || >= 2.3.2 <3' + # but only the latest MAJOR.MINOR.x to reduce the test matrix. + # + # Maintenance note: This should be updated for newer MAJOR.MINOR releases. + versions: '2.9.16 || 2.10.1 || 2.11.0 || 2.12.0 || 2.13.1 || 2.14.5 || 2.15.1 || 2.16.1 || 2.17.0 || 2.18.2 || 2.19.2 || 2.20.0 || 2.21.2 || 2.22.2 || 2.23.0 || 2.24.1 || 2.25.0 || >2.25.x <3' + node: '>=6' + commands: node apollo-server-express.test.js +apollo-server-express-2_13: + name: apollo-server-express + #preinstall: npm uninstall express-graphql + peerDependencies: graphql@^0.13.0 + # We want this version range: + # versions: '>=2.9.16 <2.2 || >= 2.3.2 <3' + # but only the latest MAJOR.MINOR.x to reduce the test matrix. + # + # Maintenance note: This should be updated for newer MAJOR.MINOR releases. + versions: '2.9.16 || 2.10.1 || 2.11.0 || 2.12.0 || 2.13.1 || 2.14.5 || 2.15.1 || 2.16.1 || 2.17.0 || 2.18.2 || 2.19.2 || 2.20.0 || 2.21.2 || 2.22.2 || 2.23.0 || 2.24.1 || 2.25.0 || >2.25.x <3' + node: '>=6' + commands: node apollo-server-express.test.js +apollo-server-express-2_14: + name: apollo-server-express + #preinstall: npm uninstall express-graphql + peerDependencies: graphql@^14.0.0 + # We want this version range: + # versions: '>=2.9.16 <2.2 || >= 2.3.2 <3' + # but only the latest MAJOR.MINOR.x to reduce the test matrix. + # + # Maintenance note: This should be updated for newer MAJOR.MINOR releases. + versions: '2.9.16 || 2.10.1 || 2.11.0 || 2.12.0 || 2.13.1 || 2.14.5 || 2.15.1 || 2.16.1 || 2.17.0 || 2.18.2 || 2.19.2 || 2.20.0 || 2.21.2 || 2.22.2 || 2.23.0 || 2.24.1 || 2.25.0 || >2.25.x <3' + node: '>=6' + commands: node apollo-server-express.test.js +apollo-server-express-2_15: + name: apollo-server-express + #preinstall: npm uninstall express-graphql + peerDependencies: graphql@^15.0.0 + # We want this version range (2.12.0 was the first release of + # apollo-server-express after graphql@15 was released): + # versions: '>= 2.12.0 <3' + # but only the latest MAJOR.MINOR.x to reduce the test matrix. + # + # Maintenance note: This should be updated for newer MAJOR.MINOR releases. + versions: '2.15.1 || 2.16.1 || 2.17.0 || 2.18.2 || 2.19.2 || 2.20.0 || 2.21.2 || 2.22.2 || 2.23.0 || 2.24.1 || 2.25.0 || >2.25.x <3' + # Per https://github.com/graphql/graphql-js/releases/tag/v15.0.0 + # graphql v15 supports node v8 as a minimum. + node: '>=8' + commands: node apollo-server-express.test.js + +apollo-server-express-3_15: + name: apollo-server-express + #preinstall: npm uninstall express-graphql + peerDependencies: graphql@^15.0.0 + versions: '^3.0.0' + node: '>=12' + commands: node apollo-server-express.test.js diff --git a/test/instrumentation/modules/apollo-server-express.test.js b/test/instrumentation/modules/apollo-server-express/apollo-server-express.test.js similarity index 98% rename from test/instrumentation/modules/apollo-server-express.test.js rename to test/instrumentation/modules/apollo-server-express/apollo-server-express.test.js index f8104399141..745435ec8e1 100644 --- a/test/instrumentation/modules/apollo-server-express.test.js +++ b/test/instrumentation/modules/apollo-server-express/apollo-server-express.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -25,7 +25,7 @@ if (semver.gte(apolloServerExpressVersion, '3.0.0') && semver.lt(process.version var ApolloServer = require('apollo-server-express').ApolloServer var gql = require('apollo-server-express').gql -var mockClient = require('../../_mock_http_client') +var mockClient = require('../../../_mock_http_client') test('POST /graphql', function (t) { resetAgent(done(t, 'hello')) diff --git a/test/instrumentation/modules/apollo-server-express/package.json b/test/instrumentation/modules/apollo-server-express/package.json new file mode 100644 index 00000000000..338330c9667 --- /dev/null +++ b/test/instrumentation/modules/apollo-server-express/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-apollo-server-express", + "version": "1.0.0", + "private": true, + "dependencies": { + "apollo-server-express": "^3.0.0" + } +} diff --git a/test/instrumentation/modules/bluebird/.npmrc b/test/instrumentation/modules/bluebird/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/bluebird/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/bluebird/.tav.yml b/test/instrumentation/modules/bluebird/.tav.yml new file mode 100644 index 00000000000..09248b4e129 --- /dev/null +++ b/test/instrumentation/modules/bluebird/.tav.yml @@ -0,0 +1,5 @@ +bluebird: + versions: '>=2 <4' + commands: + - node bluebird.test.js + - node cancel.test.js diff --git a/test/instrumentation/modules/bluebird/package.json b/test/instrumentation/modules/bluebird/package.json new file mode 100644 index 00000000000..8e4d4357d0e --- /dev/null +++ b/test/instrumentation/modules/bluebird/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-bluebird", + "version": "1.0.0", + "private": true, + "dependencies": { + "bluebird": "^3.7.2" + } +} diff --git a/test/instrumentation/modules/elasticsearch/.npmrc b/test/instrumentation/modules/elasticsearch/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/elasticsearch/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/elasticsearch/.tav.yml b/test/instrumentation/modules/elasticsearch/.tav.yml new file mode 100644 index 00000000000..8aafd6cf6e1 --- /dev/null +++ b/test/instrumentation/modules/elasticsearch/.tav.yml @@ -0,0 +1,3 @@ +elasticsearch: + versions: '>=8.0.0' + commands: node elasticsearch.test.js diff --git a/test/instrumentation/modules/elasticsearch.test.js b/test/instrumentation/modules/elasticsearch/elasticsearch.test.js similarity index 96% rename from test/instrumentation/modules/elasticsearch.test.js rename to test/instrumentation/modules/elasticsearch/elasticsearch.test.js index 282f3ee25cf..4326107c749 100644 --- a/test/instrumentation/modules/elasticsearch.test.js +++ b/test/instrumentation/modules/elasticsearch/elasticsearch.test.js @@ -1,11 +1,11 @@ 'use strict' -const { pathIsAQuery } = require('../../../lib/instrumentation/elasticsearch-shared') +const { pathIsAQuery } = require('../../../../lib/instrumentation/elasticsearch-shared') process.env.ELASTIC_APM_TEST = true var host = (process.env.ES_HOST || 'localhost') + ':9200' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -19,8 +19,8 @@ var pkg = require('elasticsearch/package.json') var semver = require('semver') var test = require('tape') -var mockClient = require('../../_mock_http_client') -var findObjInArray = require('../../_utils').findObjInArray +var mockClient = require('../../../_mock_http_client') +var findObjInArray = require('../../../_utils').findObjInArray test('client.ping with callback', function userLandCode (t) { resetAgent(done(t, 'HEAD', '/')) diff --git a/test/instrumentation/modules/elasticsearch/package.json b/test/instrumentation/modules/elasticsearch/package.json new file mode 100644 index 00000000000..1bbd75ee64d --- /dev/null +++ b/test/instrumentation/modules/elasticsearch/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-elasticsearch", + "version": "1.0.0", + "private": true, + "dependencies": { + "elasticsearch": "^16.5.0" + } +} diff --git a/test/instrumentation/modules/express-graphql/.npmrc b/test/instrumentation/modules/express-graphql/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/express-graphql/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/express-graphql/.tav.yml b/test/instrumentation/modules/express-graphql/.tav.yml new file mode 100644 index 00000000000..81e48940102 --- /dev/null +++ b/test/instrumentation/modules/express-graphql/.tav.yml @@ -0,0 +1,86 @@ +express-graphql-1: + name: express-graphql + #XXX + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.8.2 + versions: '0.6.1' + commands: node express-graphql.test.js + +express-graphql-2: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.9.0 + versions: '>=0.6.2 <0.6.6' + commands: node express-graphql.test.js + +express-graphql-3: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.10.0 + versions: '>=0.6.6 <0.6.8' + commands: node express-graphql.test.js + +express-graphql-0.6.11_10: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.10.0 + versions: '0.6.11' + commands: node express-graphql.test.js +express-graphql-0.6.11_11: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.11.0 + versions: '0.6.11' + commands: node express-graphql.test.js + +express-graphql-0.6.12_10: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.10.0 + versions: '^0.6.12' + commands: node express-graphql.test.js +express-graphql-0.6.12_11: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.11.0 + versions: '^0.6.12' + commands: node express-graphql.test.js +express-graphql-0.6.12_12: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.12.0 + versions: '^0.6.12' + commands: node express-graphql.test.js +express-graphql-0.6.12_13: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.13.0 + versions: '^0.6.12' + commands: node express-graphql.test.js + +express-graphql-0.7.1_12: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.12.0 + versions: '>=0.7.1 <0.9.0' + commands: node express-graphql.test.js +express-graphql-0.7.1_13: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^0.13.0 + versions: '>=0.7.1 <0.9.0' + commands: node express-graphql.test.js +express-graphql-0.7.1_14: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^14.0.0 + versions: '>=0.7.1 <0.9.0' + commands: node express-graphql.test.js + +express-graphql-0.9.0: + name: express-graphql + #preinstall: npm uninstall apollo-server-express + peerDependencies: graphql@^14.4.1 + versions: '>=0.9.0 <0.10.0' + node: '>=7.6.0' + commands: node express-graphql.test.js diff --git a/test/instrumentation/modules/express-graphql.test.js b/test/instrumentation/modules/express-graphql/express-graphql.test.js similarity index 98% rename from test/instrumentation/modules/express-graphql.test.js rename to test/instrumentation/modules/express-graphql/express-graphql.test.js index 4ddc64eae35..35faf612c95 100644 --- a/test/instrumentation/modules/express-graphql.test.js +++ b/test/instrumentation/modules/express-graphql/express-graphql.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -17,7 +17,7 @@ var querystring = require('querystring') var graphqlHTTP = require('express-graphql') var test = require('tape') -var mockClient = require('../../_mock_http_client') +var mockClient = require('../../../_mock_http_client') const paths = ['/graphql', '/'] diff --git a/test/instrumentation/modules/express-graphql/package.json b/test/instrumentation/modules/express-graphql/package.json new file mode 100644 index 00000000000..0bbabdfc96a --- /dev/null +++ b/test/instrumentation/modules/express-graphql/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-express-graphql", + "version": "1.0.0", + "private": true, + "dependencies": { + "express-graphql": "^0.9.0" + } +} diff --git a/test/instrumentation/modules/express-queue/.npmrc b/test/instrumentation/modules/express-queue/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/express-queue/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/express-queue/.tav.yml b/test/instrumentation/modules/express-queue/.tav.yml new file mode 100644 index 00000000000..d471443a8fb --- /dev/null +++ b/test/instrumentation/modules/express-queue/.tav.yml @@ -0,0 +1,3 @@ +express-queue: + versions: '>=0.0.11' + commands: node express-queue.test.js diff --git a/test/instrumentation/modules/express-queue.test.js b/test/instrumentation/modules/express-queue/express-queue.test.js similarity index 93% rename from test/instrumentation/modules/express-queue.test.js rename to test/instrumentation/modules/express-queue/express-queue.test.js index 980bab8751a..1b899f9914a 100644 --- a/test/instrumentation/modules/express-queue.test.js +++ b/test/instrumentation/modules/express-queue/express-queue.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -14,8 +14,8 @@ var express = require('express') var queue = require('express-queue') var test = require('tape') -var mockClient = require('../../_mock_http_client') -var findObjInArray = require('../../_utils').findObjInArray +var mockClient = require('../../../_mock_http_client') +var findObjInArray = require('../../../_utils').findObjInArray test('express-queue', function (t) { resetAgent(done(t, 'done')) diff --git a/test/instrumentation/modules/express-queue/package.json b/test/instrumentation/modules/express-queue/package.json new file mode 100644 index 00000000000..34eb92b13b5 --- /dev/null +++ b/test/instrumentation/modules/express-queue/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-express-queue", + "version": "1.0.0", + "private": true, + "dependencies": { + "express-queue": "^0.0.12" + } +} diff --git a/test/instrumentation/modules/express/.npmrc b/test/instrumentation/modules/express/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/express/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/express/.tav.yml b/test/instrumentation/modules/express/.tav.yml new file mode 100644 index 00000000000..fb837029b1b --- /dev/null +++ b/test/instrumentation/modules/express/.tav.yml @@ -0,0 +1,7 @@ +express: + versions: '>=4' + commands: + - node basic.test.js + - node capture-exceptions-off.test.js + - node capture-exceptions-on.test.js + - node set-framework.test.js diff --git a/test/instrumentation/modules/express/package.json b/test/instrumentation/modules/express/package.json new file mode 100644 index 00000000000..2957fa47d89 --- /dev/null +++ b/test/instrumentation/modules/express/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-express", + "version": "1.0.0", + "private": true, + "dependencies": { + "express": "^4.17.1" + } +} diff --git a/test/instrumentation/modules/generic-pool/.npmrc b/test/instrumentation/modules/generic-pool/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/generic-pool/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/generic-pool/.tav.yml b/test/instrumentation/modules/generic-pool/.tav.yml new file mode 100644 index 00000000000..bf509aaa6c8 --- /dev/null +++ b/test/instrumentation/modules/generic-pool/.tav.yml @@ -0,0 +1,3 @@ +generic-pool: + versions: ^2.0.0 || ^3.1.0 + commands: node generic-pool.test.js diff --git a/test/instrumentation/modules/generic-pool.test.js b/test/instrumentation/modules/generic-pool/generic-pool.test.js similarity index 98% rename from test/instrumentation/modules/generic-pool.test.js rename to test/instrumentation/modules/generic-pool/generic-pool.test.js index 13a93201672..e818153c8c1 100644 --- a/test/instrumentation/modules/generic-pool.test.js +++ b/test/instrumentation/modules/generic-pool/generic-pool.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, diff --git a/test/instrumentation/modules/generic-pool/package.json b/test/instrumentation/modules/generic-pool/package.json new file mode 100644 index 00000000000..faa2f4035d0 --- /dev/null +++ b/test/instrumentation/modules/generic-pool/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-generic-pool", + "version": "1.0.0", + "private": true, + "dependencies": { + "generic-pool": "^3.7.1" + } +} diff --git a/test/instrumentation/modules/got/.npmrc b/test/instrumentation/modules/got/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/got/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/got/.tav.yml b/test/instrumentation/modules/got/.tav.yml new file mode 100644 index 00000000000..c938f0936fa --- /dev/null +++ b/test/instrumentation/modules/got/.tav.yml @@ -0,0 +1,15 @@ +got-very-old: + name: got + versions: '>=4.0.0 <9.0.0' + node: '>=5' + commands: node github-423.test.js +got-old: + name: got + versions: ^9.0.0 + node: '>=8.3' + commands: node github-423.test.js +got-new: + name: got + versions: '>=10.0.0 <10.5.1 || >10.5.1' # v10.5.1 is broken + node: '>=10' + commands: node github-423.test.js diff --git a/test/instrumentation/modules/http/github-423.test.js b/test/instrumentation/modules/got/github-423.test.js similarity index 100% rename from test/instrumentation/modules/http/github-423.test.js rename to test/instrumentation/modules/got/github-423.test.js diff --git a/test/instrumentation/modules/got/package.json b/test/instrumentation/modules/got/package.json new file mode 100644 index 00000000000..50f43f28205 --- /dev/null +++ b/test/instrumentation/modules/got/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-got", + "version": "1.0.0", + "private": true, + "dependencies": { + "got": "^9.6.0" + } +} diff --git a/test/instrumentation/modules/graphql/.npmrc b/test/instrumentation/modules/graphql/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/graphql/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/graphql/.tav.yml b/test/instrumentation/modules/graphql/.tav.yml new file mode 100644 index 00000000000..5baed5474c2 --- /dev/null +++ b/test/instrumentation/modules/graphql/.tav.yml @@ -0,0 +1,5 @@ +graphql: + # XXX need this? + #preinstall: npm uninstall express-graphql + versions: '>=0.7.0 <0.11.0 || >=0.11.1 <16.0.0' + commands: node graphql.test.js diff --git a/test/instrumentation/modules/graphql.test.js b/test/instrumentation/modules/graphql/graphql.test.js similarity index 98% rename from test/instrumentation/modules/graphql.test.js rename to test/instrumentation/modules/graphql/graphql.test.js index 4a964df2b15..4b0fdd3e8ca 100644 --- a/test/instrumentation/modules/graphql.test.js +++ b/test/instrumentation/modules/graphql/graphql.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -13,7 +13,7 @@ var pkg = require('graphql/package.json') var semver = require('semver') var test = require('tape') -var mockClient = require('../../_mock_http_client') +var mockClient = require('../../../_mock_http_client') test('graphql.graphql', function (t) { resetAgent(done(t)) diff --git a/test/instrumentation/modules/graphql/package.json b/test/instrumentation/modules/graphql/package.json new file mode 100644 index 00000000000..1b0845604a5 --- /dev/null +++ b/test/instrumentation/modules/graphql/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-graphql", + "version": "1.0.0", + "private": true, + "dependencies": { + "graphql": "^15.3.0" + } +} diff --git a/test/instrumentation/modules/handlebars/.npmrc b/test/instrumentation/modules/handlebars/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/handlebars/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/handlebars/.tav.yml b/test/instrumentation/modules/handlebars/.tav.yml new file mode 100644 index 00000000000..003cd76f270 --- /dev/null +++ b/test/instrumentation/modules/handlebars/.tav.yml @@ -0,0 +1,3 @@ +handlebars: + versions: '*' + commands: node handlebars.test.js diff --git a/test/instrumentation/modules/handlebars.test.js b/test/instrumentation/modules/handlebars/handlebars.test.js similarity index 89% rename from test/instrumentation/modules/handlebars.test.js rename to test/instrumentation/modules/handlebars/handlebars.test.js index 312c030436a..3e7aec8ac14 100644 --- a/test/instrumentation/modules/handlebars.test.js +++ b/test/instrumentation/modules/handlebars/handlebars.test.js @@ -2,7 +2,7 @@ process.env.ELASTIC_APM_TEST = true -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -14,8 +14,8 @@ var agent = require('../../..').start({ var handlebars = require('handlebars') var test = require('tape') -var mockClient = require('../../_mock_http_client') -var findObjInArray = require('../../_utils').findObjInArray +var mockClient = require('../../../_mock_http_client') +var findObjInArray = require('../../../_utils').findObjInArray test('handlebars compile and render', function userLandCode (t) { resetAgent(function (data) { diff --git a/test/instrumentation/modules/handlebars/package.json b/test/instrumentation/modules/handlebars/package.json new file mode 100644 index 00000000000..d8b7461f4d4 --- /dev/null +++ b/test/instrumentation/modules/handlebars/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-handlebars", + "version": "1.0.0", + "private": true, + "dependencies": { + "handlebars": "^4.7.3" + } +} diff --git a/test/instrumentation/modules/hapi/.npmrc b/test/instrumentation/modules/hapi/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/hapi/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/hapi/.tav.yml b/test/instrumentation/modules/hapi/.tav.yml new file mode 100644 index 00000000000..d35f8687240 --- /dev/null +++ b/test/instrumentation/modules/hapi/.tav.yml @@ -0,0 +1,57 @@ +# hapi and @hapi/hapi +# - Package name: Starting with v17.9.0 and v18.2.0 the name changed from +# 'hapi' to '@hapi/hapi'. +# - Node version compat: +# - hapi@15: supports node >=v4; breaks on node v14 (usage of `os.tmpDir()`) +# - hapi@16: supports node >=v4 +# - hapi@17, @hapi/hapi@17: supports node >=v8.12.0 (per its README); +# the instrumentation changed significantly for this version +# - hapi@18, @hapi/hapi@18: supports node >=v8.12.0 (per its README) +# - @hapi/hapi@19: supports node >=v12 (judging from commit 50d8d7d) +# - @hapi/hapi@20: appears (from travis template refs) to support node >=v12 +hapi-v9-v15: + name: hapi + versions: '>=9.0.1 <16.0.0' + node: '>=4 <14' + commands: + - node basic-legacy-path.test.js + - node set-framework-hapi.test.js +hapi-v16: + name: hapi + versions: '>=16.0.0 <17.0.0' + node: '>=4' + commands: + - node basic-legacy-path.test.js + - node set-framework-hapi.test.js +hapi-prenodev15: + name: hapi + versions: '>=17.0.0' + node: '>=8.12.0 <15.0.0' + commands: + - node basic-legacy-path.test.js + - node set-framework-hapi.test.js +hapi: + name: hapi + # Work around https://github.com/npm/cli/issues/2267 in npm@7. + # Note: An alternative might be to just not test the "hapi" package with + # node >= 15, given that "hapi" was deprecated before node v16. + preinstall: rm -rf node_modules/hapi + node: '>=15.0.0' + versions: '>=17.0.0' + commands: + - node basic-legacy-path.test.js + - node set-framework-hapi.test.js +'@hapi/hapi-v17-v18': + name: '@hapi/hapi' + versions: '>=17.0.0 <19.0.0' + node: '>=8.12.0' + commands: + - node basic.test.js + - node set-framework-hapihapi.test.js +'@hapi/hapi': + name: '@hapi/hapi' + versions: '>=19.0.0' + node: '>=12' + commands: + - node basic.test.js + - node set-framework-hapihapi.test.js diff --git a/test/instrumentation/modules/hapi/package.json b/test/instrumentation/modules/hapi/package.json new file mode 100644 index 00000000000..e2833e7c6b8 --- /dev/null +++ b/test/instrumentation/modules/hapi/package.json @@ -0,0 +1,9 @@ +{ + "name": "test-hapi", + "version": "1.0.0", + "private": true, + "dependencies": { + "hapi": "^18.1.0", + "@hapi/hapi": "^20.1.2" + } +} diff --git a/test/instrumentation/modules/ioredis/.npmrc b/test/instrumentation/modules/ioredis/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/ioredis/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/ioredis/.tav.yml b/test/instrumentation/modules/ioredis/.tav.yml new file mode 100644 index 00000000000..737bc9c3428 --- /dev/null +++ b/test/instrumentation/modules/ioredis/.tav.yml @@ -0,0 +1,9 @@ +ioredis-old: + name: ioredis + versions: '>=2 <3.1.3 || >3.1.3 <4' # v3.1.3 is broken in older versions of Node because of https://github.com/luin/ioredis/commit/d5867f7c7f03a770a8c0ca5680fdcbfcaf8488e7 + commands: node ioredis.test.js +ioredis-new: + name: ioredis + versions: '^4.0.0' + node: '>=6' + commands: node ioredis.test.js diff --git a/test/instrumentation/modules/ioredis.test.js b/test/instrumentation/modules/ioredis/ioredis.test.js similarity index 97% rename from test/instrumentation/modules/ioredis.test.js rename to test/instrumentation/modules/ioredis/ioredis.test.js index 28ec646e576..8fc306f0bcf 100644 --- a/test/instrumentation/modules/ioredis.test.js +++ b/test/instrumentation/modules/ioredis/ioredis.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -12,7 +12,7 @@ var agent = require('../../..').start({ var Redis = require('ioredis') var test = require('tape') -var mockClient = require('../../_mock_http_client') +var mockClient = require('../../../_mock_http_client') test('not nested', function (t) { resetAgent(done(t)) diff --git a/test/instrumentation/modules/ioredis/package.json b/test/instrumentation/modules/ioredis/package.json new file mode 100644 index 00000000000..6faf2c0b115 --- /dev/null +++ b/test/instrumentation/modules/ioredis/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-ioredis", + "version": "1.0.0", + "private": true, + "dependencies": { + "ioredis": "^4.16.0" + } +} diff --git a/test/instrumentation/modules/jade/.npmrc b/test/instrumentation/modules/jade/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/jade/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/jade/.tav.yml b/test/instrumentation/modules/jade/.tav.yml new file mode 100644 index 00000000000..7e46a6e1d97 --- /dev/null +++ b/test/instrumentation/modules/jade/.tav.yml @@ -0,0 +1,3 @@ +jade: + versions: '>0.5.5' + commands: node jade.test.js diff --git a/test/instrumentation/modules/jade.test.js b/test/instrumentation/modules/jade/jade.test.js similarity index 90% rename from test/instrumentation/modules/jade.test.js rename to test/instrumentation/modules/jade/jade.test.js index 24637f27891..3b90a74fd29 100644 --- a/test/instrumentation/modules/jade.test.js +++ b/test/instrumentation/modules/jade/jade.test.js @@ -2,7 +2,7 @@ process.env.ELASTIC_APM_TEST = true -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -14,8 +14,8 @@ var agent = require('../../..').start({ var jade = require('jade') var test = require('tape') -var mockClient = require('../../_mock_http_client') -var findObjInArray = require('../../_utils').findObjInArray +var mockClient = require('../../../_mock_http_client') +var findObjInArray = require('../../../_utils').findObjInArray test('jade compile and render', function userLandCode (t) { resetAgent(function (data) { diff --git a/test/instrumentation/modules/jade/package.json b/test/instrumentation/modules/jade/package.json new file mode 100644 index 00000000000..5ef7702732a --- /dev/null +++ b/test/instrumentation/modules/jade/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-jade", + "version": "1.0.0", + "private": true, + "dependencies": { + "jade": "^1.11.0" + } +} diff --git a/test/instrumentation/modules/knex/.npmrc b/test/instrumentation/modules/knex/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/knex/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/knex/.tav.yml b/test/instrumentation/modules/knex/.tav.yml new file mode 100644 index 00000000000..57d80804ff8 --- /dev/null +++ b/test/instrumentation/modules/knex/.tav.yml @@ -0,0 +1,15 @@ +knex-old: + name: knex + # v0.16.4 accidentally dropped support for Node.js 6 + versions: ^0.16.5 || <0.16.4 >=0.16.0 || ^0.15.0 || ^0.14.0 || ^0.13.0 || ^0.12.5 || <0.12.4 >0.11.6 || <0.11.6 >0.9.0 + commands: node ../pg/knex.test.js +knex-new: + name: knex + node: '>=8.6.0' + versions: '>=0.17 <0.21' + commands: node ../pg/knex.test.js +knex-gt-nodev8: + name: knex + node: '>=10.22.0' + versions: '>=0.21 <0.22' + commands: node ../pg/knex.test.js diff --git a/test/instrumentation/modules/knex/package.json b/test/instrumentation/modules/knex/package.json new file mode 100644 index 00000000000..b7f85b8c4e0 --- /dev/null +++ b/test/instrumentation/modules/knex/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-knex", + "version": "1.0.0", + "private": true, + "dependencies": { + "knex": "^0.21.2" + } +} diff --git a/test/instrumentation/modules/koa-router/.npmrc b/test/instrumentation/modules/koa-router/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/koa-router/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/koa-router/.tav.yml b/test/instrumentation/modules/koa-router/.tav.yml new file mode 100644 index 00000000000..0761bd5250f --- /dev/null +++ b/test/instrumentation/modules/koa-router/.tav.yml @@ -0,0 +1,10 @@ +koa-router: + node: '>=6.0.0' + peerDependencies: koa@2 + versions: '>=5.2.0 <11' + commands: node old-name.test.js +'@koa/router': + node: '>=8.0.0' + peerDependencies: koa@2 + versions: '>=8 <11' + commands: node new-name.test.js diff --git a/test/instrumentation/modules/koa-router/package.json b/test/instrumentation/modules/koa-router/package.json new file mode 100644 index 00000000000..e99a536315c --- /dev/null +++ b/test/instrumentation/modules/koa-router/package.json @@ -0,0 +1,9 @@ +{ + "name": "test-koa-router", + "version": "1.0.0", + "private": true, + "dependencies": { + "@koa/router": "^9.0.1", + "koa-router": "^9.0.1" + } +} diff --git a/test/instrumentation/modules/mimic-response/.npmrc b/test/instrumentation/modules/mimic-response/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/mimic-response/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/mimic-response/.tav.yml b/test/instrumentation/modules/mimic-response/.tav.yml new file mode 100644 index 00000000000..de16993ce80 --- /dev/null +++ b/test/instrumentation/modules/mimic-response/.tav.yml @@ -0,0 +1,5 @@ +mimic-response: + versions: ^1.0.0 + commands: + - node mimic-response.test.js + - node github-179.test.js diff --git a/test/instrumentation/modules/http/github-179.test.js b/test/instrumentation/modules/mimic-response/github-179.test.js similarity index 94% rename from test/instrumentation/modules/http/github-179.test.js rename to test/instrumentation/modules/mimic-response/github-179.test.js index 5db3bff7157..4c8c92bb01b 100644 --- a/test/instrumentation/modules/http/github-179.test.js +++ b/test/instrumentation/modules/mimic-response/github-179.test.js @@ -14,7 +14,7 @@ var PassThrough = require('stream').PassThrough var mimicResponse = require('mimic-response') var test = require('tape') -var echoServer = require('./_echo_server_util').echoServer +var echoServer = require('../http/_echo_server_util').echoServer test('https://github.com/opbeat/opbeat-node/issues/179', function (t) { echoServer(function (cp, port) { diff --git a/test/instrumentation/modules/mimic-response.test.js b/test/instrumentation/modules/mimic-response/mimic-response.test.js similarity index 96% rename from test/instrumentation/modules/mimic-response.test.js rename to test/instrumentation/modules/mimic-response/mimic-response.test.js index 278c687cafe..92adfe145cf 100644 --- a/test/instrumentation/modules/mimic-response.test.js +++ b/test/instrumentation/modules/mimic-response/mimic-response.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', captureExceptions: false, metricsInterval: 0, diff --git a/test/instrumentation/modules/mimic-response/package.json b/test/instrumentation/modules/mimic-response/package.json new file mode 100644 index 00000000000..0ffc55ca59f --- /dev/null +++ b/test/instrumentation/modules/mimic-response/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-mimic-response", + "version": "1.0.0", + "private": true, + "dependencies": { + "mimic-response": "^2.1.0" + } +} diff --git a/test/instrumentation/modules/mongodb-core/.npmrc b/test/instrumentation/modules/mongodb-core/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/mongodb-core/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/mongodb-core/.tav.yml b/test/instrumentation/modules/mongodb-core/.tav.yml new file mode 100644 index 00000000000..e4b25a7075a --- /dev/null +++ b/test/instrumentation/modules/mongodb-core/.tav.yml @@ -0,0 +1,3 @@ +mongodb-core: + versions: '>=1.2.19 <4' + commands: node mongodb-core.test.js diff --git a/test/instrumentation/modules/mongodb-core.test.js b/test/instrumentation/modules/mongodb-core/mongodb-core.test.js similarity index 98% rename from test/instrumentation/modules/mongodb-core.test.js rename to test/instrumentation/modules/mongodb-core/mongodb-core.test.js index ee0ccc8e889..7ce41062583 100644 --- a/test/instrumentation/modules/mongodb-core.test.js +++ b/test/instrumentation/modules/mongodb-core/mongodb-core.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -13,7 +13,7 @@ var semver = require('semver') var test = require('tape') var mongodbCoreVersion = require('mongodb-core/package').version -var mockClient = require('../../_mock_http_client') +var mockClient = require('../../../_mock_http_client') test('instrument simple command', function (t) { // Because a variable number of events to the APM server is possible (see diff --git a/test/instrumentation/modules/mongodb-core/package.json b/test/instrumentation/modules/mongodb-core/package.json new file mode 100644 index 00000000000..8562977e0b4 --- /dev/null +++ b/test/instrumentation/modules/mongodb-core/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-mongodb-core", + "version": "1.0.0", + "private": true, + "dependencies": { + "mongodb-core": "^3.2.7" + } +} diff --git a/test/instrumentation/modules/mongodb/.npmrc b/test/instrumentation/modules/mongodb/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/mongodb/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/mongodb/.tav.yml b/test/instrumentation/modules/mongodb/.tav.yml new file mode 100644 index 00000000000..1d5d7e1d02c --- /dev/null +++ b/test/instrumentation/modules/mongodb/.tav.yml @@ -0,0 +1,3 @@ +mongodb: + versions: '>=3.3' + commands: node mongodb.test.js diff --git a/test/instrumentation/modules/mongodb.test.js b/test/instrumentation/modules/mongodb/mongodb.test.js similarity index 96% rename from test/instrumentation/modules/mongodb.test.js rename to test/instrumentation/modules/mongodb/mongodb.test.js index d62a7a46125..b7758ee9d38 100644 --- a/test/instrumentation/modules/mongodb.test.js +++ b/test/instrumentation/modules/mongodb/mongodb.test.js @@ -1,6 +1,6 @@ 'use strict' -const agent = require('../../..').start({ +const agent = require('../../../..').start({ serviceName: 'test-mongodb', captureExceptions: false, metricsInterval: 0, @@ -9,7 +9,7 @@ const agent = require('../../..').start({ }) // As of mongodb@4 only supports node >=v12. -const mongodbVersion = require('../../../node_modules/mongodb/package.json').version +const mongodbVersion = require('../../../../node_modules/mongodb/package.json').version const semver = require('semver') if (semver.gte(mongodbVersion, '4.0.0') && semver.lt(process.version, '12.0.0')) { console.log(`# SKIP mongodb@${mongodbVersion} does not support node ${process.version}`) @@ -18,7 +18,7 @@ if (semver.gte(mongodbVersion, '4.0.0') && semver.lt(process.version, '12.0.0')) const MongoClient = require('mongodb').MongoClient const test = require('tape') -const mockClient = require('../../_mock_http_client_states') +const mockClient = require('../../../_mock_http_client_states') const host = process.env.MONGODB_HOST || 'localhost' const url = `mongodb://${host}:27017` diff --git a/test/instrumentation/modules/mongodb/package.json b/test/instrumentation/modules/mongodb/package.json new file mode 100644 index 00000000000..151ef75b492 --- /dev/null +++ b/test/instrumentation/modules/mongodb/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-mongodb", + "version": "1.0.0", + "private": true, + "dependencies": { + "mongodb": "^4.1.0" + } +} diff --git a/test/instrumentation/modules/mysql/.npmrc b/test/instrumentation/modules/mysql/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/mysql/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/mysql/.tav.yml b/test/instrumentation/modules/mysql/.tav.yml new file mode 100644 index 00000000000..fd13536ec3d --- /dev/null +++ b/test/instrumentation/modules/mysql/.tav.yml @@ -0,0 +1,5 @@ +mysql: + versions: ^2.0.0 + commands: + - node mysql.test.js + - node pool-release-1.test.js diff --git a/test/instrumentation/modules/mysql/package.json b/test/instrumentation/modules/mysql/package.json new file mode 100644 index 00000000000..a3921c59390 --- /dev/null +++ b/test/instrumentation/modules/mysql/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-mysql", + "version": "1.0.0", + "private": true, + "dependencies": { + "mysql": "^2.18.1" + } +} diff --git a/test/instrumentation/modules/mysql2/.npmrc b/test/instrumentation/modules/mysql2/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/mysql2/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/mysql2/.tav.yml b/test/instrumentation/modules/mysql2/.tav.yml new file mode 100644 index 00000000000..e062adabc6a --- /dev/null +++ b/test/instrumentation/modules/mysql2/.tav.yml @@ -0,0 +1,13 @@ +mysql2-old: + name: mysql2 + versions: '>=1.0.0 <1.6.0' + commands: + - node mysql.test.js + - node pool-release-1.test.js +mysql2-new: + name: mysql2 + versions: '1.6.0 || 1.6.1 || >=1.6.3 <3' # v1.6.2 is broken: https://github.com/sidorares/node-mysql2/issues/869 + node: '>=6.0.0' + commands: + - node mysql.test.js + - node pool-release-1.test.js diff --git a/test/instrumentation/modules/mysql2/package.json b/test/instrumentation/modules/mysql2/package.json new file mode 100644 index 00000000000..ff5cc41fb8b --- /dev/null +++ b/test/instrumentation/modules/mysql2/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-mysql2", + "version": "1.0.0", + "private": true, + "dependencies": { + "mysql2": "^2.1.0" + } +} diff --git a/test/instrumentation/modules/pg/.npmrc b/test/instrumentation/modules/pg/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/pg/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/pg/.tav.yml b/test/instrumentation/modules/pg/.tav.yml new file mode 100644 index 00000000000..fa3babe5a3c --- /dev/null +++ b/test/instrumentation/modules/pg/.tav.yml @@ -0,0 +1,30 @@ +pg-old-node: + name: pg + # We want this version range: + # versions: '>=4 <9' + # but only the latest MAJOR.MINOR.x to reduce the test matrix. + # + # Maintenance note: This should be updated for newer MAJOR.MINOR releases. + versions: '4.0.0 || 4.1.1 || 4.2.0 || 4.3.0 || 4.4.6 || 4.5.7 || 5.0.0 || 5.1.0 || 5.2.1 || 6.0.5 || 6.1.6 || 6.2.5 || 6.3.3 || 6.4.2 || 7.0.3 || 7.1.2 || 7.2.0 || 7.3.0 || 7.4.3 || 7.5.0 || 7.6.1 || 7.7.1 || 7.8.2 || 7.9.0 || 7.10.0 || 7.11.0 || 7.12.1 || 7.13.0 || 7.14.0 || 7.15.2 || 7.16.1 || 7.17.1 || 7.18.2 || 8.0.3 || 8.1.0 || 8.2.2 || 8.3.3 || 8.4.2 || 8.5.1 || 8.6.0 || >8.6.0 <9' + node: '<14' + peerDependencies: + - bluebird@^3.0.0 + - knex@^0.17.3 + commands: + - node pg.test.js + - node knex.test.js +pg-new-node: + name: pg + # We want this version range: + # versions: '>=8.0.3 <9' # Prior versions didn't work in Node.js 14 + # but only the latest MAJOR.MINOR.x to reduce the test matrix. + # + # Maintenance note: This should be updated for newer MAJOR.MINOR releases. + versions: '8.0.3 || 8.1.0 || 8.2.2 || 8.3.3 || 8.4.2 || 8.5.1 || 8.6.0 || >8.6.0 <9' + node: '>=14' + peerDependencies: + - bluebird@^3.0.0 + - knex@^0.17.3 + commands: + - node pg.test.js + - node knex.test.js diff --git a/test/instrumentation/modules/pg/package.json b/test/instrumentation/modules/pg/package.json new file mode 100644 index 00000000000..844063ef80a --- /dev/null +++ b/test/instrumentation/modules/pg/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-pg", + "version": "1.0.0", + "private": true, + "dependencies": { + "pg": "^8.7.1" + } +} diff --git a/test/instrumentation/modules/pug/.npmrc b/test/instrumentation/modules/pug/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/pug/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/pug/.tav.yml b/test/instrumentation/modules/pug/.tav.yml new file mode 100644 index 00000000000..c2d62e83fab --- /dev/null +++ b/test/instrumentation/modules/pug/.tav.yml @@ -0,0 +1,3 @@ +pug: + versions: '0.1.0 || >2.0.0' + commands: node pug.test.js diff --git a/test/instrumentation/modules/pug/package.json b/test/instrumentation/modules/pug/package.json new file mode 100644 index 00000000000..b219b4fe850 --- /dev/null +++ b/test/instrumentation/modules/pug/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-pug", + "version": "1.0.0", + "private": true, + "dependencies": { + "pug": "^3.0.2" + } +} diff --git a/test/instrumentation/modules/pug.test.js b/test/instrumentation/modules/pug/pug.test.js similarity index 90% rename from test/instrumentation/modules/pug.test.js rename to test/instrumentation/modules/pug/pug.test.js index cf95f884558..e380bf2a3a0 100644 --- a/test/instrumentation/modules/pug.test.js +++ b/test/instrumentation/modules/pug/pug.test.js @@ -2,7 +2,7 @@ process.env.ELASTIC_APM_TEST = true -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -14,8 +14,8 @@ var agent = require('../../..').start({ var pug = require('pug') var test = require('tape') -var mockClient = require('../../_mock_http_client') -var findObjInArray = require('../../_utils').findObjInArray +var mockClient = require('../../../_mock_http_client') +var findObjInArray = require('../../../_utils').findObjInArray test('pug compile and render', function userLandCode (t) { resetAgent(function (data) { diff --git a/test/instrumentation/modules/redis/.npmrc b/test/instrumentation/modules/redis/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/redis/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/redis/.tav.yml b/test/instrumentation/modules/redis/.tav.yml new file mode 100644 index 00000000000..8a53313755a --- /dev/null +++ b/test/instrumentation/modules/redis/.tav.yml @@ -0,0 +1,3 @@ +redis: + versions: '>=2.0.0 <4.0.0' + commands: node redis.test.js diff --git a/test/instrumentation/modules/redis/package.json b/test/instrumentation/modules/redis/package.json new file mode 100644 index 00000000000..4d2e7dc1609 --- /dev/null +++ b/test/instrumentation/modules/redis/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-redis", + "version": "1.0.0", + "private": true, + "dependencies": { + "redis": "^3.0.2" + } +} diff --git a/test/instrumentation/modules/redis.test.js b/test/instrumentation/modules/redis/redis.test.js similarity index 93% rename from test/instrumentation/modules/redis.test.js rename to test/instrumentation/modules/redis/redis.test.js index 164e6b97cd3..5264097159a 100644 --- a/test/instrumentation/modules/redis.test.js +++ b/test/instrumentation/modules/redis/redis.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -11,8 +11,8 @@ var agent = require('../../..').start({ var redis = require('redis') var test = require('tape') -var mockClient = require('../../_mock_http_client') -var findObjInArray = require('../../_utils').findObjInArray +var mockClient = require('../../../_mock_http_client') +var findObjInArray = require('../../../_utils').findObjInArray test(function (t) { resetAgent(function (data) { diff --git a/test/instrumentation/modules/restify/.npmrc b/test/instrumentation/modules/restify/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/restify/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/restify/.tav.yml b/test/instrumentation/modules/restify/.tav.yml new file mode 100644 index 00000000000..d148b4c8033 --- /dev/null +++ b/test/instrumentation/modules/restify/.tav.yml @@ -0,0 +1,13 @@ +restify-old: + name: restify + versions: '>=5.2.0 <8.0.0' + commands: + - node basic.test.js + - node set-framework.test.js +restify-new: + name: restify + node: '>=8.6.0' + versions: '>=8.0.0' + commands: + - node basic.test.js + - node set-framework.test.js diff --git a/test/instrumentation/modules/restify/package.json b/test/instrumentation/modules/restify/package.json new file mode 100644 index 00000000000..8ec6128e1dd --- /dev/null +++ b/test/instrumentation/modules/restify/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-restify", + "version": "1.0.0", + "private": true, + "dependencies": { + "restify": "^8.5.1" + } +} diff --git a/test/instrumentation/modules/ws/.npmrc b/test/instrumentation/modules/ws/.npmrc new file mode 100644 index 00000000000..43c97e719a5 --- /dev/null +++ b/test/instrumentation/modules/ws/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test/instrumentation/modules/ws/.tav.yml b/test/instrumentation/modules/ws/.tav.yml new file mode 100644 index 00000000000..4a5de9d105d --- /dev/null +++ b/test/instrumentation/modules/ws/.tav.yml @@ -0,0 +1,9 @@ +ws-old: + name: ws + versions: '>=1 <7' + commands: node ws.test.js +ws-new: + name: ws + node: '>=8.6.0' + versions: '>=7 <8' + commands: node ws.test.js diff --git a/test/instrumentation/modules/ws/package.json b/test/instrumentation/modules/ws/package.json new file mode 100644 index 00000000000..890cc8a1e66 --- /dev/null +++ b/test/instrumentation/modules/ws/package.json @@ -0,0 +1,8 @@ +{ + "name": "test-ws", + "version": "1.0.0", + "private": true, + "dependencies": { + "ws": "^7.2.1" + } +} diff --git a/test/instrumentation/modules/ws.test.js b/test/instrumentation/modules/ws/ws.test.js similarity index 93% rename from test/instrumentation/modules/ws.test.js rename to test/instrumentation/modules/ws/ws.test.js index ad13f36ee91..c03115014b8 100644 --- a/test/instrumentation/modules/ws.test.js +++ b/test/instrumentation/modules/ws/ws.test.js @@ -1,6 +1,6 @@ 'use strict' -var agent = require('../../..').start({ +var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', captureExceptions: false, @@ -11,7 +11,7 @@ var agent = require('../../..').start({ var test = require('tape') var WebSocket = require('ws') -var mockClient = require('../../_mock_http_client') +var mockClient = require('../../../_mock_http_client') var PORT = 12342 diff --git a/test/script/prepare-tests.sh b/test/script/prepare-tests.sh new file mode 100755 index 00000000000..53d27f0e3e0 --- /dev/null +++ b/test/script/prepare-tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Prepare for testing by 'npm install'ing in module test dirs with package.json +# files. +# + +if [ "$TRACE" != "" ]; then + export PS4='${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' + set -o xtrace +fi +set -o errexit +set -o pipefail + +TESTDIR=$(cd $(dirname $0)/.. >/dev/null && pwd) + +function fatal { + echo "$(basename $0): error: $*" + exit 1 +} + +ls $TESTDIR/instrumentation/modules/*/package.json | while read f; do + d=$(dirname $f) + echo "# $d" + (cd $d && npm install) +done diff --git a/test/script/run_tests.sh b/test/script/run_tests.sh index 5d3017dbdde..891e2b4f220 100755 --- a/test/script/run_tests.sh +++ b/test/script/run_tests.sh @@ -41,6 +41,12 @@ run_test_suite () { standard npm run test:deps + # Automatically prepare for tests if this looks like a first time run of + # 'npm test'. Using 'pug/' as a canary dir. + if [[ ! -d test/instrumentation/modules/pug/node_modules ]]; then + npm run test:prepare + fi + if [ -z "$COVERAGE" ] then node test/test.js diff --git a/test/script/tav-in-module-dirs.sh b/test/script/tav-in-module-dirs.sh new file mode 100755 index 00000000000..5b157f2f00b --- /dev/null +++ b/test/script/tav-in-module-dirs.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Run `tav` in each of the test/instrumentation/modules/$module dirs. +# + +if [ "$TRACE" != "" ]; then + export PS4='${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' + set -o xtrace +fi +set -o errexit +set -o pipefail + +TAV_EXEC=$(pwd)/node_modules/.bin/tav +find ./test/instrumentation/modules -name .tav.yml | while read f; do + echo "-- $f" + (cd $(dirname $f) && $TAV_EXEC --quiet) +done diff --git a/test/test.js b/test/test.js index 7dff126d390..5aede50efe7 100644 --- a/test/test.js +++ b/test/test.js @@ -76,19 +76,33 @@ var directories = [ 'test/instrumentation', 'test/instrumentation/modules', 'test/instrumentation/modules/@elastic', + 'test/instrumentation/modules/apollo-server-express', + 'test/instrumentation/modules/aws-sdk', 'test/instrumentation/modules/bluebird', 'test/instrumentation/modules/cassandra-driver', + 'test/instrumentation/modules/elasticsearch', 'test/instrumentation/modules/express', + 'test/instrumentation/modules/express-graphql', + 'test/instrumentation/modules/express-queue', 'test/instrumentation/modules/fastify', + 'test/instrumentation/modules/generic-pool', + 'test/instrumentation/modules/got', + 'test/instrumentation/modules/graphql', + 'test/instrumentation/modules/handlebars', 'test/instrumentation/modules/hapi', 'test/instrumentation/modules/http', + 'test/instrumentation/modules/ioredis', + 'test/instrumentation/modules/jade', 'test/instrumentation/modules/koa', 'test/instrumentation/modules/koa-router', + 'test/instrumentation/modules/mimic-response', 'test/instrumentation/modules/mysql', 'test/instrumentation/modules/mysql2', 'test/instrumentation/modules/pg', + 'test/instrumentation/modules/pug', + 'test/instrumentation/modules/redis', 'test/instrumentation/modules/restify', - 'test/instrumentation/modules/aws-sdk', + 'test/instrumentation/modules/ws', 'test/instrumentation/run-context', 'test/integration', 'test/integration/api-schema',