Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix tests to work with restify@9 #3031

Merged
merged 3 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .tav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,28 @@ cassandra-driver:
versions: '>=3 <3.1.0 || >3.1.0 <5'
commands: node test/instrumentation/modules/cassandra-driver/index.test.js

restify-old:
# Restify
# - restify <v10 doesn't work with node v18+ (https://github.com/restify/node-restify/issues/1888)
# - restify v9 used `require('node:...')` that requires node >v14.18.0
# (https://nodejs.org/api/modules.html#core-modules)
restify-v5-v8:
name: restify
versions: '>=5.2.0 <8.0.0'
node: '<18.0.0'
commands:
- node test/instrumentation/modules/restify/basic.test.js
- node test/instrumentation/modules/restify/set-framework.test.js
restify-new:
restify-v8-v9:
name: restify
node: '>=8.6.0'
versions: '>=8.0.0'
versions: '>=8.0.0 <9.0.0'
node: '>=8.6.0 <18.0.0'
commands:
- node test/instrumentation/modules/restify/basic.test.js
- node test/instrumentation/modules/restify/set-framework.test.js
restify:
name: restify
versions: '>=9.0.0'
node: '>=14.18.0 <18.0.0'
commands:
- node test/instrumentation/modules/restify/basic.test.js
- node test/instrumentation/modules/restify/set-framework.test.js
Expand Down
8 changes: 7 additions & 1 deletion lib/instrumentation/modules/restify.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ const semver = require('semver')
const shimmer = require('../shimmer')

module.exports = function (restify, agent, { version, enabled }) {
if (!enabled) return restify
if (!enabled) {
return restify
}
if (!semver.satisfies(version, '>=5.2.0 <10.0.0')) {
agent.logger.debug('restify version %s not supported, skipping', version)
return restify
}

agent.setFramework({ name: 'restify', version, overwrite: false })

Expand Down
Loading