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

Adds a test for the response of the execute pipeline endpoint

parent 72b7b635
No related branches found
No related tags found
No related merge requests found
......@@ -123,19 +123,6 @@ class TestGraphAPI(object):
switch_nodes = set([node["name"] for node in graph_db.nodes.match("Switch")])
assert switch_nodes == set("127.0.0." + str(i) for i in range(1, 7)), "Switch nodes must have been created by the db_testing_data fixture"
# test with invalid body - missing 'from' and 'to' parameters
service_functions = dict(nginx={"measurement_name": "nginx", "response_time_field": "mean(avg_processing_time)",
"request_size_field": "mean(avg_request_size)", "response_size_field": "mean(avg_response_size)"},
minio={"measurement_name": "minio_http", "response_time_field": "mean(total_processing_time)/mean(total_requests_count)",
"request_size_field": "mean(total_requests_size)/mean(total_requests_count)", "response_size_field": "mean(total_response_size)/mean(total_requests_count)"},
apache={"measurement_name": "apache", "response_time_field": "mean(avg_processing_time)",
"request_size_field": "mean(avg_request_size)", "response_size_field": "mean(avg_response_size)"})
body = dumps(dict(service_function_chain="sfc", service_function_chain_instance="sfc_1", service_functions=service_functions))
request = testing.DummyRequest()
request.body = body.encode(request.charset)
with pytest.raises(HTTPBadRequest):
GraphAPI(request).build_temporal_graph()
# Create a valid build request and send it to the API endpoint
uuid_mock.return_value = self.graph_1_test_id
service_functions = dict(nginx={"measurement_name": "nginx", "response_time_field": "mean(avg_processing_time)",
......@@ -508,12 +495,27 @@ class TestGraphAPI(object):
error_raised = True
assert error_raised, error_msg
def test_execute_pipeline_graph(self):
@patch('clmcservice.graphapi.views.uuid4')
def test_execute_pipeline_graph(self, uuid_mock):
"""
Tests the functionality to start a pipeline script executing the graph API workflow - build, query, delete
"""
assert False, "Not implemented"
uuid_mock.return_value = "monitor_test_uuid1"
service_functions = dict(nginx={"measurement_name": "nginx", "response_time_field": "mean(avg_processing_time)",
"request_size_field": "mean(avg_request_size)", "response_size_field": "mean(avg_response_size)"},
minio={"measurement_name": "minio_http", "response_time_field": "mean(total_processing_time)/mean(total_requests_count)",
"request_size_field": "mean(total_requests_size)/mean(total_requests_count)", "response_size_field": "mean(total_response_size)/mean(total_requests_count)"})
monitor_json_body = dict(service_function_chain="test_sfc", service_function_chain_instance="test_sfc_premium", service_functions=service_functions)
monitor_json_body["query_period"] = 30
monitor_json_body["results_measurement_name"] = "graph_measurements"
body = dumps(monitor_json_body)
request = testing.DummyRequest()
request.body = body.encode(request.charset)
response = GraphAPI(request).execute_graph_pipeline()
assert response == {"uuid": uuid_mock.return_value, "database": "test_sfc"}
assert False, "Implement tests for checking that an actual process is started."
@staticmethod
def check_exist_relationship(relationships_tuple, graph, uuid):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment