def test_existing_user_with_correct_password_works(self): version1 = ProxySQLBaseTest.run_query_mysql( "SELECT @@version_comment LIMIT 1", "test", return_result=True, username="******", password="******") version2 = ProxySQLBaseTest.run_query_proxysql( "SELECT @@version_comment LIMIT 1", "test", return_result=True, username="******", password="******") self.assertEqual(version1, version2)
def test_monitor_tables_locking_errors(self): """Test that intensive read/write operations to the MySQL Monitor tables do not trigger locking errors. This test will be successful if there will be no generated error at the end. """ # 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") queries = [] q1 = "select * from monitor.mysql_server_connect_log ORDER BY RANDOM() LIMIT 10" q2 = "select * from monitor.mysql_server_ping_log ORDER BY RANDOM() LIMIT 10" for _ in xrange(10000): queries.append(random.choice([q1, q2])) pool = ThreadPool(processes=5) pool.map(ProxySQLBaseTest.run_query_proxysql_admin, queries) # If we reached this point without an error, it means that the test # has passed. self.assertEqual(1, 1)
def test_select_strings_returns_correct_result(self): rows = ProxySQLBaseTest.run_query_proxysql("SELECT * FROM strings", "test") self.assertEqual(set([row[0] for row in rows]), set(['a', 'ab', 'abc', 'abcd']))
def test_proxy_doesnt_crash_under_mild_sysbench_load(self): ProxySQLBaseTest.run_sysbench_proxysql()
def test_inexisting_user_with_random_password_does_not_work(self): version = ProxySQLBaseTest.run_query_proxysql( "SELECT @@version_comment LIMIT 1", "test", return_result=True, username="******", password="******")
def test_existing_user_with_incorrect_password_does_not_work(self): version = ProxySQLBaseTest.run_query_proxysql( "SELECT @@version_comment LIMIT 1", "test", return_result=True, username="******", password="******")
def test_existing_user_with_correct_password_but_not_registerd_within_proxysql_does_not_work(self): version1 = ProxySQLBaseTest.run_query_proxysql( "SELECT @@version_comment LIMIT 1", "test", return_result=True, username="******", password="******")
def test_stop_main_thread(self): # This test will just assert that PROXYSQL STOP works correctly ProxySQLBaseTest.run_query_proxysql_admin("PROXYSQL STOP")