#410 Migrating tests to new multiple-OS format

pull/413/head
Andrei-Adnan Ismail 11 years ago
parent 8aa060ac11
commit cb86e08a6d

@ -5,9 +5,7 @@ from proxysql_base_test import ProxySQLBaseTest
class AdminTablesTest(ProxySQLBaseTest):
SCENARIO = "./scenarios/1backend"
def test_monitor_tables_locking_errors(self):
def _test_monitor_tables_locking_errors(self):
"""Test that intensive read/write operations to the MySQL Monitor tables
do not trigger locking errors.
@ -18,9 +16,9 @@ class AdminTablesTest(ProxySQLBaseTest):
# Setting these variables will cause the Monitor to connect more
# frequently to the backend hosts to check their health, thus increasing
# the probability of locking errors to appear.
ProxySQLBaseTest.run_query_proxysql_admin("UPDATE global_variables SET variable_value=100 WHERE variable_name='mysql-monitor_connect_interval'")
ProxySQLBaseTest.run_query_proxysql_admin("UPDATE global_variables SET variable_value=100 WHERE variable_name='mysql-monitor_ping_interval'")
ProxySQLBaseTest.run_query_proxysql_admin("LOAD MYSQL VARIABLES TO RUNTIME")
self.run_query_proxysql_admin("UPDATE global_variables SET variable_value=100 WHERE variable_name='mysql-monitor_connect_interval'")
self.run_query_proxysql_admin("UPDATE global_variables SET variable_value=100 WHERE variable_name='mysql-monitor_ping_interval'")
self.run_query_proxysql_admin("LOAD MYSQL VARIABLES TO RUNTIME")
queries = []
q1 = "select * from monitor.mysql_server_connect_log ORDER BY RANDOM() LIMIT 10"
@ -29,9 +27,11 @@ class AdminTablesTest(ProxySQLBaseTest):
queries.append(random.choice([q1, q2]))
pool = ThreadPool(processes=5)
pool.map(ProxySQLBaseTest.run_query_proxysql_admin,
queries)
pool.map(self.run_query_proxysql_admin, queries)
# If we reached this point without an error, it means that the test
# has passed.
self.assertEqual(1, 1)
self.assertEqual(1, 1)
def test_monitor_tables_locking_errors(self):
self.run_in_docker_scenarios(self._test_monitor_tables_locking_errors)

@ -1,16 +1,19 @@
from proxysql_base_test import ProxySQLBaseTest
from MySQLdb import OperationalError
from nose.tools import raises
class AdminTest(ProxySQLBaseTest):
SCENARIO = "./scenarios/1backend"
def _test_stop_main_thread(self):
try:
# This test will just assert that PROXYSQL STOP works correctly
# Since September 2015, the behaviour has been changed - PROXYSQL STOP
# executes faster and immediately shuts down the connections, thus this
# test is expected to raise OperationalError
self.run_query_proxysql_admin("PROXYSQL STOP")
self.assertEqual(0, 1)
except OperationalError:
self.assertEqual(1, 1)
@raises(OperationalError)
def test_stop_main_thread(self):
# This test will just assert that PROXYSQL STOP works correctly
# Since September 2015, the behaviour has been changed - PROXYSQL STOP
# executes faster and immediately shuts down the connections, thus this
# test is expected to raise OperationalError
ProxySQLBaseTest.run_query_proxysql_admin("PROXYSQL STOP")
self.run_in_docker_scenarios(self._test_stop_main_thread)

@ -4,8 +4,11 @@ from proxysql_base_test import ProxySQLBaseTest
class OneBackendTest(ProxySQLBaseTest):
def test_select_strings_returns_correct_result(self):
def _test_select_strings_returns_correct_result(self):
rows = ProxySQLBaseTest.run_query_proxysql("SELECT * FROM strings", "test")
rows = self.run_query_proxysql("SELECT * FROM strings", "test")
self.assertEqual(set([row[0] for row in rows]),
set(['a', 'ab', 'abc', 'abcd']))
set(['a', 'ab', 'abc', 'abcd']))
def test_select_strings_returns_correct_result(self):
self.run_in_docker_scenarios(self._test_select_strings_returns_correct_result)

@ -2,5 +2,8 @@ from proxysql_base_test import ProxySQLBaseTest
class SysBenchTest(ProxySQLBaseTest):
def _test_proxy_doesnt_crash_under_mild_sysbench_load(self):
self.run_sysbench_proxysql()
def test_proxy_doesnt_crash_under_mild_sysbench_load(self):
ProxySQLBaseTest.run_sysbench_proxysql()
self.run_in_docker_scenarios(self._test_proxy_doesnt_crash_under_mild_sysbench_load)
Loading…
Cancel
Save