/
http.one-connection.client.js
58 lines (54 loc) · 2.03 KB
/
http.one-connection.client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const test = require('tape')
// eslint-disable-next-line no-unused-vars
const ocat = require('./utils/ocat')
const spok = require('spok')
const userFunctions = require('./common/http.one-connection.client.user-functions')
const { HttpClientConnectionProcessor } = require('../')
const activities = new Map(require('../test/fixtures/http-one-connection.client.json'))
const SOCKETID = 10
test('\nactivities for a client that established one connection to a server', function(t) {
const includeActivities = false
const separateFunctions = true
const { operations, groups } =
new HttpClientConnectionProcessor({ activities, includeActivities, separateFunctions }).process()
t.equal(groups.size, 1, 'finds one client connection group')
const op = operations.get(SOCKETID)
spok(t, op,
{ lifeCycle:
{ created: { ms: '18.11ms', ns: 18110308 }
, destroyed: { ms: '110.46ms', ns: 110458934 }
, timeAlive: { ms: '92.35ms', ns: 92348626 } }
, createdAt: 'at Agent.createSocket (_http_agent.js:220:26)'
, socket: { id: 10, triggerId: 1 }
, getaddrinfo: { id: 11, triggerId: SOCKETID }
, connect: { id: 16, triggerId: SOCKETID }
, httpParser:
{ id: 14
, triggerId: 1
, incoming:
{ httpVersion: '1.1'
, headersHost: null
, headersConnection: 'close'
, url: ''
, method: null
, complete: false
, upgrade: false
, statusCode: 302
, statusMessage: { type: 'string', len: 5, included: 5, val: 'Found' } }
, outgoing:
{ header: 'GET / HTTP/1.1\r\nHost: google.com\r\nConnection: close\r\n\r\n'
, statusCode: spok.notDefined
, statusMessage: null
, finished: true
, headerSent: true
, upgrading: false
, chunkedEncoding: false
, shouldKeepAlive: false
, sendDate: false
, hasBody: true
, sent100: spok.notDefined } }
, shutdown: { id: 26, triggerId: 10 }
, userFunctions }
)
t.end()
})