Skip to content

Commit

Permalink
feat: node 15 support
Browse files Browse the repository at this point in the history
  • Loading branch information
kevcodez committed Nov 27, 2020
1 parent e6018a6 commit c406360
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 4 deletions.
1 change: 1 addition & 0 deletions .ci/.jenkins_nightly_nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NODEJS_VERSION:
- "15"
- "14"
- "13"
- "12"
Expand Down
1 change: 1 addition & 0 deletions .ci/.jenkins_nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NODEJS_VERSION:
- "15"
- "14"
- "14.0"
- "13"
Expand Down
1 change: 1 addition & 0 deletions .ci/.jenkins_rc_nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NODEJS_VERSION:
- "15"
- "14"
- "13"
- "12"
Expand Down
1 change: 1 addition & 0 deletions .ci/.jenkins_tav_nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NODEJS_VERSION:
- "15"
- "14"
- "13"
- "12"
Expand Down
8 changes: 8 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
package-lock=false

# Workaround unresolvable peerDependencies between express-graphql, graphql,
# and apollo-server-express. npm v7 (included with node v15) makes these
# peerDependencies issues an install error. Until the community catches up
# and resolves peerDependencies issues or this modules tests are setup to
# not have competing deps in "devDependencies", we revert to the pre-v7
# behavior. https://docs.npmjs.com/cli/v7/using-npm/config#legacy-peer-deps
legacy-peer-deps=true
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ before_script:
- wait-on tcp:9200

node_js:
- '15'
- '14'
- '14.0'
- '13'
Expand All @@ -57,6 +58,9 @@ jobs:

include:
# Disable Async Hooks
-
node_js: '15'
env: ELASTIC_APM_ASYNC_HOOKS=false
-
node_js: '14'
env: ELASTIC_APM_ASYNC_HOOKS=false
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"url": "git://github.com/elastic/apm-agent-nodejs.git"
},
"engines": {
"node": "^8.6.0 || 10 || 12 || 13 || 14"
"node": "^8.6.0 || 10 || 12 || 13 || 14 || 15"
},
"keywords": [
"opbeat",
Expand Down Expand Up @@ -145,7 +145,7 @@
"generic-pool": "^3.7.1",
"get-port": "^5.1.1",
"got": "^9.6.0",
"graphql": "^15.3.0",
"graphql": "^15.4.0",
"handlebars": "^4.7.3",
"hapi": "^18.1.0",
"https-pem": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/instrumentation/_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function mockAgent (expected, cb) {
_spanFilters: new Filters(),
_transport: mockClient(expected, cb || noop),
logger: consoleLogLevel({
level: 'fatal'
level: process.env.ELASTIC_APM_LOG_LEVEL || 'fatal'
}),
setFramework: function () {}
}
Expand Down
21 changes: 20 additions & 1 deletion test/instrumentation/modules/http/aborted-requests-enabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ test('client-side abort below error threshold - call end', { timeout: 10000 }, f

var server = http.createServer(function (req, res) {
setTimeout(function () {
// Explicitly respond with headers before aborting the client request,
// because:
// (a) `assert(t, data)` above asserts that `trans.result` has been set
// to "HTTP 2xx", which depends on the wrapped `writeHead` having been
// called, and
// (b) calling res.write('...') or res.end('...') *after* a clientReq.abort()
// in node >=15 leads to a race on whether `ServerResponse.writeHead()`
// is called.
//
// The race:
// - clientReq.abort() closes the client-side of the socket
// - The server-side of the socket closes (`onClose` in lib/_http_agent.js)
// - (race) If the server-side socket is closed before `res.write` is
// called, then res.writeHead() will not be called as of this change:
// https://github.com/nodejs/node/pull/31818/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556L661-R706
res.writeHead(200)
clientReq.abort()
res.write('sync write')
process.nextTick(function () {
Expand Down Expand Up @@ -80,9 +96,10 @@ test('client-side abort above error threshold - call end', function (t) {

var server = http.createServer(function (req, res) {
setTimeout(function () {
res.writeHead(200) // See race comment above.
clientReq.abort()
setTimeout(function () {
res.write('Hello') // server emits clientError if written in same tick as abort
res.write('Hello')
setTimeout(function () {
res.end(' World')
}, 10)
Expand Down Expand Up @@ -197,6 +214,7 @@ test('server-side abort below error threshold and socket closed - call end', fun
}

var server = http.createServer(function (req, res) {
res.writeHead(200) // See race comment above.
setTimeout(function () {
t.ok(timedout, 'should have closed socket')
t.notOk(ended, 'should not have ended transaction')
Expand Down Expand Up @@ -240,6 +258,7 @@ test('server-side abort above error threshold and socket closed - call end', fun
}

var server = http.createServer(function (req, res) {
res.writeHead(200) // See race comment above.
setTimeout(function () {
t.ok(timedout, 'should have closed socket')
t.notOk(ended, 'should not have ended transaction')
Expand Down

0 comments on commit c406360

Please sign in to comment.