From 6794b35eb0587bdd82380e8df478c931eb294e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sun, 17 Sep 2017 13:08:34 +0300 Subject: [PATCH] Remove Python SQL tests The tests that involved SQL weren't run and did not really test what was intended to be tested; the use of a Java Connector with MaxScale. --- maxscale-system-test/CMakeLists.txt | 6 -- maxscale-system-test/maxpython.py | 89 ----------------------------- maxscale-system-test/mxs585.py | 16 ------ maxscale-system-test/mxs598.py | 27 --------- maxscale-system-test/nsfilter.py | 16 ------ 5 files changed, 154 deletions(-) delete mode 100644 maxscale-system-test/maxpython.py delete mode 100755 maxscale-system-test/mxs585.py delete mode 100755 maxscale-system-test/mxs598.py delete mode 100755 maxscale-system-test/nsfilter.py diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 27ec1d99f..04e834d16 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -388,12 +388,6 @@ add_test_executable(mxs559_block_master.cpp mxs559_block_master mxs559 LABELS re # Playing with blocking and unblocking nodes under INSERT load add_test_executable(mxs564_big_dump.cpp mxs564_big_dump galera_mxs564 LABELS readwritesplit readconnroute GALERA_BACKEND) -# Executes simple queries from python script in the loop -add_test_script(mxs585.py mxs585.py replication LABELS readwritesplit readconnroute UNSTABLE HEAVY REPL_BACKEND) - -# Simple transactions in the loop from python script with client SSL on -add_test_script(mxs598.py mxs598.py ssl LABELS MySQLProtocol UNSTABLE HEAVY REPL_BACKEND) - # Regression case for the bug "MaxScale fails to start silently if config file is not readable" add_test_executable(mxs621_unreadable_cnf.cpp mxs621_unreadable_cnf replication LABELS maxscale REPL_BACKEND) diff --git a/maxscale-system-test/maxpython.py b/maxscale-system-test/maxpython.py deleted file mode 100644 index 254c13c32..000000000 --- a/maxscale-system-test/maxpython.py +++ /dev/null @@ -1,89 +0,0 @@ - -import sys -import subprocess -import os -import time -import jaydebeapi - -# Abstract SQL connection -class SQLConnection: - def __init__(self, port = '3306', host = '127.0.0.1', user = 'root', password = ''): - self.host = str(host) - self.port = str(port) - self.user = str(user) - self.password = str(password) - - # Connect to a server - def connect(self, options = ""): - try: - self.conn = jaydebeapi.connect("org.mariadb.jdbc.Driver", ["jdbc:mariadb://" + self.host + ":" + self.port + "/test?" + options, self.user, self.password],"./maxscale/java/mariadb-java-client-1.3.3.jar") - except Exception as ex: - print("Failed to connect to " + self.host + ":" + self.port + " as " + self.user + ":" + self.password) - print(unicode(ex)) - exit(1) - - # Start a transaction - def begin(self): - curs = self.conn.cursor() - curs.execute("BEGIN") - curs.close() - # Commit a transaction - def commit(self): - curs = self.conn.cursor() - curs.execute("COMMIT") - curs.close() - - # Query and test if the result matches the expected value if one is provided - def query(self, query, compare = None, column = 0): - curs = self.conn.cursor() - curs.execute(query) - return curs.fetchall() - - def query_and_compare(self, query, column): - data = self.query(query) - for row in data: - if str(row[column]) == compare: - return True - return False - - def disconnect(self): - self.conn.close() - - def query_and_close(self, query): - self.connect() - self.query(query) - self.disconnect() - -# Test environment abstraction -class MaxScaleTest: - def __init__(self, testname = "python_test"): - - self.testname = testname - prepare_test(testname) - - # MaxScale connections - self.maxscale = dict() - self.maxscale['rwsplit'] = SQLConnection(host = os.getenv("maxscale_IP"), port = "4006", user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - self.maxscale['rcmaster'] = SQLConnection(host = os.getenv("maxscale_IP"), port = "4008", user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - self.maxscale['rcslave'] = SQLConnection(host = os.getenv("maxscale_IP"), port = "4009", user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - - # Master-Slave nodes - self.repl = dict() - self.repl['node0'] = SQLConnection(host = os.getenv("node_000_network"), port = os.getenv("node_000_port"), user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - self.repl['node1'] = SQLConnection(host = os.getenv("node_001_network"), port = os.getenv("node_001_port"), user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - self.repl['node2'] = SQLConnection(host = os.getenv("node_002_network"), port = os.getenv("node_002_port"), user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - self.repl['node3'] = SQLConnection(host = os.getenv("node_003_network"), port = os.getenv("node_003_port"), user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - - # Galera nodes - self.galera = dict() - self.galera['node0'] = SQLConnection(host = os.getenv("galera_000_network"), port = os.getenv("galera_000_port"), user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - self.galera['node1'] = SQLConnection(host = os.getenv("galera_001_network"), port = os.getenv("galera_001_port"), user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - self.galera['node2'] = SQLConnection(host = os.getenv("galera_002_network"), port = os.getenv("galera_002_port"), user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - self.galera['node3'] = SQLConnection(host = os.getenv("galera_003_network"), port = os.getenv("galera_003_port"), user = os.getenv("maxscale_user"), password = os.getenv("maxscale_password")) - - def __del__(self): - subprocess.call(os.getcwd() + "/copy_logs.sh " + str(self.testname), shell=True) - -# Read test environment variables -def prepare_test(testname = "replication"): - subprocess.call(os.getcwd() + "/non_native_setup " + str(testname), shell=True) diff --git a/maxscale-system-test/mxs585.py b/maxscale-system-test/mxs585.py deleted file mode 100755 index 49b1d094f..000000000 --- a/maxscale-system-test/mxs585.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -### -## @file mxs585.py Regression case for MXS-585 "Intermittent connection failure with MaxScale 1.2/1.3 using MariaDB/J 1.3" -## - open connection, execute simple query and close connection in the loop - -import maxpython - -test1 = maxpython.MaxScaleTest("mxs585.py") - -for i in range(0,100): - if i % 10 == 0: - print(str(i)) - test1.maxscale['rwsplit'].query_and_close("select 1") - test1.maxscale['rcmaster'].query_and_close("select 1") - test1.maxscale['rcslave'].query_and_close("select 1") diff --git a/maxscale-system-test/mxs598.py b/maxscale-system-test/mxs598.py deleted file mode 100755 index ddb07180f..000000000 --- a/maxscale-system-test/mxs598.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - - -### -## @file mxs598.py Regression case for MXS-598 "SSL RW Router / JDBC Exception" -## - use SSL for Maxscale client connection -## - simple transactions in the loop - -import maxpython - -test1 = maxpython.MaxScaleTest("mxs598.py") - -print("Connecting to MaxScale") -for i in test1.maxscale.values(): - i.connect("useSSL=true&requireSSL=true&verifyServerCert=false") - -print("Trying 100 simple transactions on all services") -for i in range(0,100): - for x in test1.maxscale.values(): - x.begin() - x.query("insert into test.t1 values (1)") - x.query("select * from test.t1") - x.commit() - -print("Closing connections") -for i in test1.maxscale.values(): - i.disconnect() diff --git a/maxscale-system-test/nsfilter.py b/maxscale-system-test/nsfilter.py deleted file mode 100755 index 329be7886..000000000 --- a/maxscale-system-test/nsfilter.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -import maxpython - -test = maxpython.MaxScaleTest("nsfilter") - -server_id = [] - -for conn in test.repl: - server_id[conn] = conn.query("SELECT @@server_id") - -nomatch = test.maxscale['rwsplit'].query("SELECT @@server_id") -match = test.maxscale['rwsplit'].query("SELECT \"test\", @@server_id") - -print(nomatch) -print(match)