19
20
# along with this program; if not, write to the Free Software
20
21
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
from copy import deepcopy
26
30
from lib.util.sysbench_methods import prepare_sysbench
27
31
from lib.util.sysbench_methods import execute_sysbench
28
32
from lib.util.sysbench_methods import process_sysbench_output
29
from lib.util.mysqlBaseTestCase import mysqlBaseTestCase
33
from lib.util.sysbench_methods import sysbench_db_analysis
34
from lib.util.sysbench_methods import getSysbenchReport
35
from lib.util.sysbenchTestCase import sysbenchTestCase
36
from lib.util.database_connect import results_db_connect
37
from lib.util.mailing_report import sendMail
31
39
# TODO: make server_options vary depending on the type of server being used here
33
#server_requirements = [['innodb.buffer-pool-size=256M innodb.log-file-size=64M innodb.log-buffer-size=8M innodb.thread-concurrency=0 innodb.additional-mem-pool-size=16M table-open-cache=4096 table-definition-cache=4096 mysql-protocol.max-connections=2048']]
41
server_requirements = [['innodb.buffer-pool-size=256M innodb.log-file-size=64M innodb.log-buffer-size=8M innodb.thread-concurrency=0 innodb.additional-mem-pool-size=16M table-open-cache=4096 table-definition-cache=4096 mysql-protocol.max-connections=2048']]
35
44
#server_requirements = [['innodb_buffer_pool_size=256M innodb_log_file_size=64M innodb_log_buffer_size=8M innodb_thread_concurrency=0 innodb_additional_mem_pool_size=16M table_open_cache=4096 table_definition_cache=4096 max_connections=2048']]
36
server_requirements = [[]]
38
47
server_manager = None
39
48
test_executor = None
41
class basicTest(mysqlBaseTestCase):
50
class basicTest(sysbenchTestCase):
43
52
def test_sysbench_readonly(self):
44
self.logging = test_executor.logging
54
# defining the test command
45
55
master_server = servers[0]
46
# our base test command
56
self.config_name = 'innodb_1000K_readonly'
47
57
test_cmd = [ "sysbench"
49
59
, "--max-requests=0"
58
68
, "--%s-host=localhost" %master_server.type
59
69
, "--db-driver=%s" %master_server.type
62
71
if master_server.type == 'drizzle':
63
72
test_cmd.append("--drizzle-mysql=on")
64
73
if master_server.type == 'mysql':
65
74
test_cmd.append("--mysql-socket=%s" %master_server.socket_file)
67
# We sleep for a minute to wait
69
# how many times to run sysbench at each concurrency
72
# various concurrencies to use with sysbench
73
#concurrencies = [16, 32, 64, 128, 256, 512, 1024]
74
concurrencies = [1, 4, 8 ]
76
# preparing sysbench_readonly test
77
self.prepareSysbench(test_cmd,test_executor,servers)
77
for concurrency in concurrencies:
78
self.logging.info("Resetting test server...")
79
for query in ["DROP SCHEMA IF EXISTS test"
82
retcode, result = self.execute_query(query, master_server, schema="INFORMATION_SCHEMA")
83
test_cmd.append("--num-threads=%d" %concurrency)
84
# we setup once per concurrency, copying drizzle-automation
85
# this should likely change and if not for readonly, then definitely
88
exec_cmd = " ".join(test_cmd)
89
retcode, output = prepare_sysbench(test_executor, exec_cmd)
90
err_msg = ("sysbench 'prepare' phase failed.\n"
92
"output: %s" %(retcode,output))
93
self.assertEqual(retcode, 0, msg = err_msg)
95
for test_iteration in range(iterations):
96
retcode, output = execute_sysbench(test_executor, exec_cmd)
97
self.assertEqual(retcode, 0, msg = output)
98
parsed_output = process_sysbench_output(output)
99
self.logging.info(parsed_output)
80
# this method takes care of *running* the test and *saving* the test results
81
self.executeSysbench()
83
# reporting the test result
84
# this method handles *dsn_string* and *mail_tgt*
85
self.reportTestData(dsn_string,mail_tgt)
101
87
def tearDown(self):
102
88
server_manager.reset_servers(test_executor.name)