-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/fiberless' into feature/async-events
# Conflicts: # .github/workflows/test.yml
- Loading branch information
Showing
15 changed files
with
93 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ export const EventType = { | |
HTTP: 'http', | ||
Start: 'start', | ||
Wait: 'wait', | ||
Email: 'email', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,9 +87,7 @@ Package.onTest(function (api) { | |
'tests/event_loop_monitor.js', | ||
], 'server'); | ||
|
||
if (canRunTestsWithFetch()) { | ||
api.addFiles(['tests/hijack/http_fetch.js'], 'server'); | ||
} | ||
api.addFiles(['tests/hijack/http_fetch.js'], 'server'); | ||
|
||
// common client | ||
api.addFiles([ | ||
|
@@ -110,21 +108,6 @@ Package.onTest(function (api) { | |
], ['client', 'server']); | ||
}); | ||
|
||
// use meteor/fetch in tests only for NodeJS 8.11+ (Meteor 1.7+) | ||
function canRunTestsWithFetch () { | ||
const nums = process.versions.node.split('.').map(Number); | ||
|
||
const major = nums[0]; | ||
const minor = nums[1]; | ||
|
||
if (major < 8) return false; | ||
|
||
if (major > 8) return true; | ||
|
||
// major === 8 and ... | ||
return minor >= 11; | ||
} | ||
|
||
function configurePackage (api, isTesting) { | ||
api.versionsFrom('[email protected]'); | ||
api.use('montiapm:[email protected]', ['server']); | ||
|
@@ -143,7 +126,7 @@ function configurePackage (api, isTesting) { | |
api.use(['http', 'email'], 'server', { weak: !isTesting }); | ||
|
||
api.use('fetch', 'server', { | ||
weak: !(isTesting && canRunTestsWithFetch()), | ||
weak: !isTesting, | ||
}); | ||
|
||
api.use(['random', 'ecmascript', 'tracker'], ['client']); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ addAsyncTest( | |
const expected = [ | ||
['start'], | ||
['wait'], | ||
['emailAsync'], | ||
['email'], | ||
['complete'] | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,47 @@ | ||
import { WebApp } from 'meteor/webapp'; | ||
import { wrapWebApp } from '../../lib/hijack/wrap_webapp'; | ||
import { addAsyncTest, releaseParts } from '../_helpers/helpers'; | ||
import { addAsyncTest } from '../_helpers/helpers'; | ||
|
||
// Check if Meteor 1.7 or newer, which are the | ||
// versions that wrap connect handlers in a fiber and are easy | ||
// to wrap the static middleware | ||
const httpMonitoringEnabled = releaseParts[0] > 1 || | ||
(releaseParts[0] > 0 && releaseParts[1] > 6); | ||
|
||
if (httpMonitoringEnabled) { | ||
wrapWebApp(); | ||
|
||
addAsyncTest( | ||
'Webapp - return connect app from .use', | ||
async function (test) { | ||
const result = WebApp.expressHandlers.use((req, res, next) => { | ||
next(); | ||
}); | ||
|
||
test.equal(result, WebApp.expressHandlers); | ||
} | ||
); | ||
|
||
addAsyncTest( | ||
'Webapp - filter headers', | ||
async function (test) { | ||
Kadira.tracer.redactField('x--test--authorization'); | ||
|
||
let req = { | ||
url: '/test', | ||
method: 'GET', | ||
headers: { | ||
'content-type': 'application/json', | ||
'content-length': '1000', | ||
'x--test--authorization': 'secret' | ||
} | ||
}; | ||
|
||
const firstMiddleware = WebApp.rawExpressHandlers.parent._router.stack[0].handle; | ||
addAsyncTest( | ||
'Webapp - return connect app from .use', | ||
async function (test) { | ||
const result = WebApp.expressHandlers.use((req, res, next) => { | ||
next(); | ||
}); | ||
|
||
await new Promise((resolve) => { | ||
firstMiddleware( | ||
req, | ||
{ on () {} }, | ||
function () { | ||
const expected = JSON.stringify({ | ||
'content-type': 'application/json', | ||
'content-length': '1000', | ||
'x--test--authorization': 'Monti: redacted' | ||
}); | ||
test.equal(req.__kadiraInfo.trace.events[0].data.headers, expected); | ||
resolve(); | ||
test.equal(result, WebApp.expressHandlers); | ||
} | ||
); | ||
|
||
addAsyncTest( | ||
'Webapp - filter headers', | ||
async function (test) { | ||
Kadira.tracer.redactField('x--test--authorization'); | ||
|
||
let req = { | ||
url: '/test', | ||
method: 'GET', | ||
headers: { | ||
'content-type': 'application/json', | ||
'content-length': '1000', | ||
'x--test--authorization': 'secret' | ||
} | ||
}; | ||
|
||
const firstMiddleware = WebApp.rawExpressHandlers.parent._router.stack[0].handle; | ||
|
||
await new Promise((resolve) => { | ||
firstMiddleware( | ||
req, | ||
{ on () {} }, | ||
function () { | ||
const expected = JSON.stringify({ | ||
'content-type': 'application/json', | ||
'content-length': '1000', | ||
'x--test--authorization': 'Monti: redacted' | ||
}); | ||
}); | ||
test.equal(req.__kadiraInfo.trace.events[0].data.headers, expected); | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
}); |
Oops, something went wrong.