Skip to content
Snippets Groups Projects
Commit 47db335d authored by Nikolay Stanchev's avatar Nikolay Stanchev
Browse files

Updates graph api tests

parent a0ab515a
No related branches found
No related tags found
No related merge requests found
......@@ -126,6 +126,21 @@ class TestGraphAPI(object):
error_raised = True
assert error_raised, "A bad request error must have been raised in case of invalid URL parameters."
service_functions = dict(nginx={"measurement_name": "nginx", "response_time_field": "mean(avg_processing_time)"},
minio={"measurement_name": "minio_http", "response_time_field": "mean(total_processing_time)/mean(total_requests_count)"},
apache={"measurement_name": "apache", "response_time_field": "mean(avg_processing_time)"})
body = dumps(dict(database=test_db_name, retention_policy="autogen", service_function_chain_instance="sfc_1", service_functions=service_functions))
request = testing.DummyRequest()
request.params["from"] = "not a timestamp"
request.params["to"] = "not a timestamp"
request.body = body.encode(request.charset)
error_raised = False
try:
GraphAPI(request).build_temporal_graph()
except HTTPBadRequest:
error_raised = True
assert error_raised, "A bad request error must have been raised in case of invalid URL parameters."
service_functions = dict(nginx={"measurement_name": "nginx", "response_time_field": "mean(avg_processing_time)"},
minio={"measurement_name": "minio_http", "response_time_field": "mean(total_processing_time)/mean(total_requests_count)"})
build_json_body = dict(database=test_db_name, retention_policy="autogen", service_function_chain_instance="test_sfc1_1", service_functions=service_functions)
......
......@@ -96,9 +96,12 @@ def validate_graph_url_params(params):
assert param in params, "Incorrect url parameters - required url query parameter '{0}' is not found in the request parameters.".format(param)
url_params[param] = params[param]
# convert timestamps to integers
url_params['from'] = int(url_params['from'])
url_params['to'] = int(url_params['to'])
try:
# convert timestamps to integers
url_params['from'] = int(url_params['from'])
url_params['to'] = int(url_params['to'])
except ValueError:
assert False, "Invalid URL timestamp parameters"
return url_params
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment