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

tests: fix TAV test breakage with node 17 (hapi <=16, fastify <0.36.0) #2387

Merged
merged 4 commits into from
Oct 25, 2021
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
22 changes: 21 additions & 1 deletion .tav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,28 @@ restify-new:
- 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 [email protected] 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:
versions: '>=0.27.0 <0.29.0 || >0.29.0 <2.4.0 || >2.4.0'
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
Expand Down
10 changes: 8 additions & 2 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ Notes:
[float]
===== Breaking changes

* Remove support for instrumenting versions of fastify earlier than 1.0.0.
This instrumentation might still work, but is no longer supported.
Fastify v1.0.0 was released in 2018. All current users should be using
fastify v2 or v3 at least. See https://www.fastify.io/docs/latest/LTS/
({pull}2387[#2387])

[float]
===== Features

* Add initial support for version 8 of `@elastic/elasticsearch` (which is
still in pre-release).
* Add initial support for version 8 of `@elastic/elasticsearch`, which is
still in pre-release. ({pull}2385[#2385])

[float]
===== Bug fixes
Expand Down
1 change: 1 addition & 0 deletions docs/fastify.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ include::./shared-set-up.asciidoc[tag=add-your-own-data]
==== Compatibility

include::./shared-set-up.asciidoc[tag=compatibility-link]
See also: https://www.fastify.io/docs/latest/LTS/[Fastify's own LTS documentation.]

[float]
[[fastify-troubleshooting]]
Expand Down
2 changes: 1 addition & 1 deletion docs/supported-technologies.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ These are the frameworks that we officially support:
router information for full support. We currently support the most popular Koa router called
https://github.com/alexmingoia/koa-router[koa-router].
|<<restify,Restify>> |>=5.2.0
|<<fastify,Fastify>> |>=0.27.0
|<<fastify,Fastify>> |>=1.0.0; see also https://www.fastify.io/docs/latest/LTS/[Fastify's own LTS documentation]
|=======================================================================

[float]
Expand Down
3 changes: 3 additions & 0 deletions lib/instrumentation/modules/fastify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
'use strict'

// Instrumentation of fastify.
// https://www.fastify.io/docs/latest/LTS/

const semver = require('semver')

module.exports = function (fastify, agent, { version, enabled }) {
Expand Down
9 changes: 8 additions & 1 deletion test/instrumentation/modules/hapi/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,16 @@ module.exports = (moduleName) => {
})

function makeServer (opts) {
var server = new Hapi.Server({ host: 'localhost' })
// Specify 'localhost' to avoid Hapi default of '0.0.0.0' which ties to
// IPv4. We want a later HTTP client request using 'localhost' to work.
var server
if (semver.satisfies(pkg.version, '<17')) {
server = new Hapi.Server()
opts = opts || {}
opts.host = opts.host || 'localhost'
server.connection(opts)
} else {
server = new Hapi.Server({ host: 'localhost' })
}
return server
}
Expand Down