melhorando testes

This commit is contained in:
José Henrique Ivanchechen 2023-09-24 12:56:02 -03:00
parent 2dbdbea018
commit 94c2296738
2 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,16 @@
FRAMEWORKS = [
('Actix', 'tcc-actix'),
('ASP.NET', 'tcc-aspnet'),
('Flask', 'tcc-flask'),
]
ENDPOINTS = {
'Actix': 'http://localhost:9083',
'ASP.NET': 'http://localhost:9081',
'Flask': 'http://localhost:9082',
}
BLUR_RADIUS = 5
API_REQUESTS = [
('/status/ok', 'GET', range(0, 30_000, 5000), None),
('/image/save-big-image', 'POST', range(0, 10_000, 1_000), open('big-image.png', 'rb').read()),

View File

@ -6,19 +6,14 @@ import sys
import os
from math import floor
from init import init
from common import API_REQUESTS
if len(sys.argv) < 2 or len(sys.argv) > 3 or sys.argv[1] == '-h' or sys.argv[1] == '--help':
print("Usage: python testes.py <framework name> [container name]")
sys.exit(1)
from common import FRAMEWORKS, ENDPOINTS, API_REQUESTS
init()
THREADS = 10
FRAMEWORK_NAME = sys.argv[1]
CONTAINER_NAME = sys.argv[2] if len(sys.argv) > 2 else ""
FRAMEWORK_NAME = ""
CONTAINER_NAME = ""
URL_BASE = 'http://localhost:9090'
BLUR_RADIUS = 5
def send_request(url, method = 'GET', payload = None):
success = False
@ -135,6 +130,11 @@ if __name__ == "__main__":
if not os.path.exists("data"):
os.mkdir("data")
for endpoint, method, num_requests, metadata in API_REQUESTS:
print(f"# {endpoint}")
run_tests(endpoint, method, num_requests, metadata)
for i in range(len(FRAMEWORKS)):
FRAMEWORK_NAME = FRAMEWORKS[i][0]
CONTAINER_NAME = FRAMEWORKS[i][1]
URL_BASE = ENDPOINTS[FRAMEWORK_NAME]
for endpoint, method, num_requests, metadata in API_REQUESTS:
print(f"# {endpoint}")
run_tests(endpoint, method, num_requests, metadata)