tcc/scripts/common.py

48 lines
1.5 KiB
Python

import json
import person_pb2
person_proto = person_pb2.Person()
person_proto.name = "John Doe"
person_proto.age = 30
person_proto.friends.extend(["Jane Doe", "John Smith"])
person_proto.email = "john.doe@email.com"
person_proto.phone = "123-456-7890"
person_proto = person_proto.SerializeToString()
person_json = {
"name": "John Doe",
"age": 30,
"friends": ["Jane Doe", "John Smith"],
"email": "john.doe@email.com",
"phone": "123-456-7890"
}
person_json = json.dumps(person_json)
FRAMEWORKS = [
('Actix', 'tcc-actix', 'orange'),
('ASP.NET', 'tcc-aspnet', 'blue'),
('Flask', 'tcc-flask', 'grey'),
('Express', 'tcc-express', 'red'),
('Spring', 'tcc-spring', 'green'),
]
ENDPOINTS = {
'Actix': 'http://localhost:9083',
'ASP.NET': 'http://localhost:9081',
'Flask': 'http://localhost:9082',
'Express': 'http://localhost:9084',
'Spring': 'http://localhost:9085',
}
AVG_RUNS = 30
API_REQUESTS = [
('/status/ok', 'GET', range(0, 30_000, 5000), None),
('/simulation/harmonic-progression?n=100000', 'GET', range(0, 30_000, 5000), None),
('/simulation/json', 'POST', range(0, 30_000, 5000), (person_json, "application/json")),
('/simulation/protobuf', 'POST', range(0, 30_000, 5000), (person_proto, "application/protobuf")),
('/image/save-big-image', 'POST', range(0, 500, 50), (open('big-image.png', 'rb').read(), "image/png")),
('/static/small-image.png', 'GET', range(0, 30_000, 5000), None),
('/static/big-image.png', 'GET', range(0, 500, 50), None),
]