2
# -*- mode: python; indent-tabs-mode: nil; -*-
3
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
5
# Copyright (C) 2011 Patrick Crews
6
# Copyright (C) 2012 M.Sharan Kumar
9
# This program is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
from copy import deepcopy
30
from lib.util.sysbench_methods import prepare_sysbench
31
from lib.util.sysbench_methods import execute_sysbench
32
from lib.util.sysbench_methods import process_sysbench_output
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
39
# TODO: make server_options vary depending on the type of server being used here
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']]
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']]
50
class basicTest(sysbenchTestCase):
52
def test_sysbench_readonly(self):
54
# defining the test command
55
master_server = servers[0]
56
self.config_name = 'innodb_1000K_readonly'
57
test_cmd = [ "sysbench"
61
, "--db-ps-mode=disable"
62
, "--%s-table-engine=innodb" %master_server.type
63
, "--oltp-read-only=off"
64
, "--oltp-table-size=1000000"
65
, "--%s-user=root" %master_server.type
66
, "--%s-db=test" %master_server.type
67
, "--%s-port=%d" %(master_server.type, master_server.master_port)
68
, "--%s-host=localhost" %master_server.type
69
, "--db-driver=%s" %master_server.type
72
if master_server.type == 'drizzle':
73
test_cmd.append("--drizzle-mysql=on")
74
if master_server.type == 'mysql':
75
test_cmd.append("--mysql-socket=%s" %master_server.socket_file)
77
# preparing sysbench_readonly test
78
self.prepareSysbench(test_cmd,test_executor,servers)
81
# this method takes care of *running* the test and *saving* the test results
82
self.executeSysbench()
84
# reporting the test result
85
# this method handles *dsn_string* and *mail_tgt*
86
self.reportTestData(dsn_string,mail_tgt)
89
server_manager.reset_servers(test_executor.name)