/
test_record.py
55 lines (53 loc) · 1.57 KB
/
test_record.py
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
from aiozipkin.record import Record
from aiozipkin.helpers import TraceContext, Endpoint
def test_basic_ctr():
context = TraceContext('string', 'string', 'string', True, True, True)
local_endpoint = Endpoint('string', 'string', 'string', 0)
remote_endpoint = Endpoint('string', 'string', 'string', 0)
record = (Record(context, local_endpoint)
.start(0)
.name('string')
.set_tag('additionalProp1', 'string')
.set_tag('additionalProp2', 'string')
.set_tag('additionalProp3', 'string')
.kind('CLIENT')
.annotate('string', 0)
.remote_endpoint(remote_endpoint)
.finish(0)
)
dict_record = record.asdict()
expected = {
'traceId': 'string',
'name': 'string',
'parentId': 'string',
'id': 'string',
'kind': 'CLIENT',
'timestamp': 0,
'duration': 1,
'debug': True,
'shared': True,
'localEndpoint': {
'serviceName': 'string',
'ipv4': 'string',
'ipv6': 'string',
'port': 0
},
'remoteEndpoint': {
'serviceName': 'string',
'ipv4': 'string',
'ipv6': 'string',
'port': 0
},
'annotations': [
{
'timestamp': 0,
'value': 'string'
}
],
'tags': {
'additionalProp1': 'string',
'additionalProp2': 'string',
'additionalProp3': 'string'
}
}
assert dict_record == expected