Skip to content
Snippets Groups Projects
Commit 1b0bf5ae authored by Simon Crowle's avatar Simon Crowle
Browse files

Renames influx_db client fixture

get_db_client -> influx_db
parent f017582c
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ def streaming_sim_params(streaming_sim_config): ...@@ -40,7 +40,7 @@ def streaming_sim_params(streaming_sim_config):
@pytest.fixture(params=[{'database': 'CLMCMetrics'}], scope='module') @pytest.fixture(params=[{'database': 'CLMCMetrics'}], scope='module')
def get_db_client(streaming_sim_config, request): def influx_db(streaming_sim_config, request):
""" """
Creates an Influx DB client for the CLMC metrics database Creates an Influx DB client for the CLMC metrics database
......
...@@ -25,13 +25,13 @@ class TestSimulation(object): ...@@ -25,13 +25,13 @@ class TestSimulation(object):
('SELECT count(*) FROM "CLMCMetrics"."autogen"."mpegdash_service_config" WHERE ipendpoint=\'adaptive_streaming_I1_apache2\'', ('SELECT count(*) FROM "CLMCMetrics"."autogen"."mpegdash_service_config" WHERE ipendpoint=\'adaptive_streaming_I1_apache2\'',
{"time" : "1970-01-01T00:00:00Z", "count_avg_running" : 3602, "count_avg_starting" : 3602, "count_avg_stopped" : 3602, "count_avg_stopping" : 3602, "count_running" : 3602, "count_starting" : 3602, "count_stopped" : 3602, "count_stopping" : 3602}), {"time" : "1970-01-01T00:00:00Z", "count_avg_running" : 3602, "count_avg_starting" : 3602, "count_avg_stopped" : 3602, "count_avg_stopping" : 3602, "count_running" : 3602, "count_starting" : 3602, "count_stopped" : 3602, "count_stopping" : 3602}),
]) ])
def test_simulation(self, query, expected_result, get_db_client, run_simulation_fixture): def test_simulation(self, query, expected_result, influx_db, run_simulation_fixture):
""" """
This is the entry point of the test. This method will be found and executed when the module is ran using pytest This is the entry point of the test. This method will be found and executed when the module is ran using pytest
:param query: the query to execute (value obtained from the pytest parameter decorator) :param query: the query to execute (value obtained from the pytest parameter decorator)
:param expected_result: the result expected from executing the query (value obtained from the pytest parameter decorator) :param expected_result: the result expected from executing the query (value obtained from the pytest parameter decorator)
:param get_db_client the import db client fixture - imported from contest.py :param influx_db the import db client fixture - imported from contest.py
:param run_simulation_fixture: the imported fixture to use to generate the testing data - the return value of the fixture is not needed in this case :param run_simulation_fixture: the imported fixture to use to generate the testing data - the return value of the fixture is not needed in this case
""" """
...@@ -40,7 +40,7 @@ class TestSimulation(object): ...@@ -40,7 +40,7 @@ class TestSimulation(object):
print("\n") # prints a blank line for formatting purposes print("\n") # prints a blank line for formatting purposes
# the raise_errors=False argument is given so that we could actually test that the DB didn't return any errors instead of raising an exception # the raise_errors=False argument is given so that we could actually test that the DB didn't return any errors instead of raising an exception
query_result = get_db_client.query(query, raise_errors=False) query_result = influx_db.query(query, raise_errors=False)
# test the error attribute of the result is None, that is no error is returned from executing the DB query # test the error attribute of the result is None, that is no error is returned from executing the DB query
assert query_result.error is None, "An error was encountered while executing query {0}.".format(query) assert query_result.error is None, "An error was encountered while executing query {0}.".format(query)
......
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