Skip to content

Commit 071a45b

Browse files
committed
test(e2e): add back Trace API call test
1 parent 77252c4 commit 071a45b

3 files changed

Lines changed: 29 additions & 28 deletions

File tree

test/e2e/apiCalls.spec.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ var apiCalls = [
3030
'RpmMetrics',
3131
'ApmMetrics',
3232
'ExternalEdgeMetrics',
33-
'IncomingEdgeMetrics'
34-
// 'Trace'
33+
'IncomingEdgeMetrics',
34+
'Trace'
3535
]
3636

3737
apiCalls.forEach(function (name) {
3838
test('should report ' + name,
3939
{
40+
// FIXME: I patched nock, so it can gunzip requests on appropriate
41+
// content-encoding headers, however it uses the sync API due to
42+
// design limitations in nock.
43+
skip: name == 'Trace' && !zlib.gunzipSync,
4044
isolate: 'child-process',
4145
childProcessOpts: cpOpts
4246
}, function (t) {

test/e2e/crash/index.spec.js

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,30 @@ var env = {
2222
TRACE_COLLECTOR_API_URL: 'http://127.0.0.1:' + TEST_WEB_SERVER_PORT
2323
}
2424

25-
test('should report crash', function (t) {
26-
if (semver.satisfies(process.version, '>= 6')) {
27-
t.plan(2)
28-
var app = express()
29-
app.use(bodyParser.json())
30-
app.post('/transaction-events', function (req, res) {
31-
var event = req.body.e.find(function (e) {
32-
return e.t === 'err' && e.d.t === 'system-error'
33-
})
34-
t.ok(event != null, 'Error event exists')
35-
t.end()
36-
process.exit(0)
25+
test('should report crash', {
26+
skip: !semver.satisfies(process.version, '>= 6')
27+
}, function (t) {
28+
t.plan(2)
29+
var app = express()
30+
app.use(bodyParser.json())
31+
app.post('/transaction-events', function (req, res) {
32+
var event = req.body.e.find(function (e) {
33+
return e.t === 'err' && e.d.t === 'system-error'
3734
})
38-
app.listen(TEST_WEB_SERVER_PORT, function (err) {
39-
t.error(err, 'server starts listening at ' + TEST_WEB_SERVER_PORT)
35+
t.ok(event != null, 'Error event exists')
36+
t.end()
37+
process.exit(0)
38+
})
39+
app.listen(TEST_WEB_SERVER_PORT, function (err) {
40+
t.error(err, 'server starts listening at ' + TEST_WEB_SERVER_PORT)
4041

41-
spawnSync('node', [path.join(__dirname, 'testee.js')], {
42+
spawnSync('node', [path.join(__dirname, 'testee.js')], {
4243

43-
env: defaultsDeep({}, env, process.env)
44-
})
45-
setTimeout(function () {
46-
t.fail('test timed out without completing')
47-
process.exit(1)
48-
}, TEST_TIMEOUT)
44+
env: defaultsDeep({}, env, process.env)
4945
})
50-
} else {
51-
t.pass('Test does not apply for this version')
52-
t.end()
53-
}
46+
setTimeout(function () {
47+
t.fail('test timed out without completing')
48+
process.exit(1)
49+
}, TEST_TIMEOUT)
50+
})
5451
})

test/e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"body-parser": "^1.15.2",
1010
"express": "^4.14.0",
1111
"lodash.defaultsdeep": "^4.5.1",
12-
"nock": "9.0.2",
1312
"sinon": "1.17.6",
13+
"nock": "git+https://github.com/szdavid92/nock.git#feat/gzip-content-type-decoder",
1414
"semver": "^5.3.0",
1515
"spawn-sync": "^1.0.15",
1616
"string.prototype.startswith": "^0.2.0",

0 commit comments

Comments
 (0)