From 4edb0f98675712c09f973534390a5f2c215887fc Mon Sep 17 00:00:00 2001 From: Andrei Ismail Date: Sat, 20 Jun 2015 12:03:24 +0200 Subject: [PATCH] #291 Add API for running a ProxySQL admin command in SQL This is ran against the SQL admin port of the proxy. --- src/gdb-commands.txt | 3 +++ test/proxysql_base_test.py | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/gdb-commands.txt diff --git a/src/gdb-commands.txt b/src/gdb-commands.txt new file mode 100644 index 000000000..ea4d2ac3c --- /dev/null +++ b/src/gdb-commands.txt @@ -0,0 +1,3 @@ +set pagination off +target remote 0.0.0.0:2345 +continue \ No newline at end of file diff --git a/test/proxysql_base_test.py b/test/proxysql_base_test.py index fd511b0d0..555eb12ae 100644 --- a/test/proxysql_base_test.py +++ b/test/proxysql_base_test.py @@ -215,6 +215,28 @@ class ProxySQLBaseTest(TestCase): if return_result: return rows + def run_query_proxysql_admin(self, query, return_result=True): + """Run a query against the ProxySQL admin. + + Note: we do not need to specify a db for this query, as it's always + against the "main" database. + TODO(andrei): revisit db assumption once stats databases from ProxySQL + are accessible via the MySQL interface. + """ + + return self.run_query_proxysql( + query, + # "main" database is hardcoded within the + # ProxySQL admin -- it contains the SQLite3 + # tables with metadata about servers and users + "main", + return_result, + username=ProxySQLBaseTest.PROXYSQL_ADMIN_USERNAME, + password=ProxySQLBaseTest.PROXYSQL_ADMIN_PASSWORD, + port=ProxySQLBaseTest.PROXYSQL_ADMIN_PORT + ) + + def run_query_mysql(self, query, db, return_result=True, hostgroup=0, username=None, password=None): """Run a query against the MySQL backend and optionally return its