diff options
author | unknown <anozdrin@mysql.com> | 2005-10-01 01:14:50 +0400 |
---|---|---|
committer | unknown <anozdrin@mysql.com> | 2005-10-01 01:14:50 +0400 |
commit | 43c8f453e5353cf1d81368fdac732b6ff8519920 (patch) | |
tree | ae2d126f149e3a5b22bc6f216d72f8c332064d07 /mysql-test | |
parent | 46d8163b1b53a61e75ff43cb140e6055dc7cad05 (diff) | |
download | mariadb-git-43c8f453e5353cf1d81368fdac732b6ff8519920.tar.gz |
WL#2789 "Instance Manager: test using mysql-test-run testing framework"
Add Instance Manager tests.
mysql-test/include/im_check_os.inc:
Currently Instance Manager tests are known to work only on UNIX platform.
This header file is included in each IM-test in order to skip the test
on Windows.
mysql-test/r/im_daemon_life_cycle.result:
Results file for Instance Manager daemon test.
mysql-test/r/im_life_cycle.result:
Results file for Instance Manager life cycle test.
mysql-test/r/im_options_set.result:
Results file for Instance Manager SET statement test.
mysql-test/r/im_options_unset.result:
Results file for Instance Manager UNSET statement test.
mysql-test/r/im_utils.result:
Results file for Instance Manager utils test.
mysql-test/t/im_daemon_life_cycle-im.opt:
Options file for Instance Manager daemon test.
mysql-test/t/im_daemon_life_cycle.imtest:
Instance Manager daemon test (mysqltestrun-part).
mysql-test/t/im_life_cycle.imtest:
Instance Manager life cycle test.
mysql-test/t/im_options_set.imtest:
Instance Manager SET statement test.
mysql-test/t/im_options_unset.imtest:
Instance Manager UNSET statement test.
mysql-test/t/im_utils.imtest:
Instance Manager utils test.
mysql-test/t/kill_n_check.sh:
The helper script. Its main idea is to kill some process and
check that the process will (or will not) be restarted.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/include/im_check_os.inc | 7 | ||||
-rw-r--r-- | mysql-test/r/im_daemon_life_cycle.result | 7 | ||||
-rw-r--r-- | mysql-test/r/im_life_cycle.result | 64 | ||||
-rw-r--r-- | mysql-test/r/im_options_set.result | 20 | ||||
-rw-r--r-- | mysql-test/r/im_options_unset.result | 15 | ||||
-rw-r--r-- | mysql-test/r/im_utils.result | 91 | ||||
-rw-r--r-- | mysql-test/t/im_daemon_life_cycle-im.opt | 2 | ||||
-rw-r--r-- | mysql-test/t/im_daemon_life_cycle.imtest | 15 | ||||
-rw-r--r-- | mysql-test/t/im_life_cycle.imtest | 141 | ||||
-rw-r--r-- | mysql-test/t/im_options_set.imtest | 142 | ||||
-rw-r--r-- | mysql-test/t/im_options_unset.imtest | 150 | ||||
-rw-r--r-- | mysql-test/t/im_utils.imtest | 115 | ||||
-rwxr-xr-x | mysql-test/t/kill_n_check.sh | 66 |
13 files changed, 835 insertions, 0 deletions
diff --git a/mysql-test/include/im_check_os.inc b/mysql-test/include/im_check_os.inc new file mode 100644 index 00000000000..9465115feb5 --- /dev/null +++ b/mysql-test/include/im_check_os.inc @@ -0,0 +1,7 @@ +--connect (dflt_server_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK) +--connection dflt_server_con + +--source include/not_windows.inc + +--connection default +--disconnect dflt_server_con diff --git a/mysql-test/r/im_daemon_life_cycle.result b/mysql-test/r/im_daemon_life_cycle.result new file mode 100644 index 00000000000..d0a76b450fe --- /dev/null +++ b/mysql-test/r/im_daemon_life_cycle.result @@ -0,0 +1,7 @@ +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 offline +Killing the process... +Sleeping... +Success: the process was restarted. diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result new file mode 100644 index 00000000000..810953e0578 --- /dev/null +++ b/mysql-test/r/im_life_cycle.result @@ -0,0 +1,64 @@ +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 offline +SHOW INSTANCE STATUS mysqld1; +instance_name status version +mysqld1 online VERSION +SHOW INSTANCE STATUS mysqld2; +instance_name status version +mysqld2 offline VERSION +START INSTANCE mysqld2; +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 online +SHOW INSTANCE STATUS mysqld1; +instance_name status version +mysqld1 online VERSION +SHOW INSTANCE STATUS mysqld2; +instance_name status version +mysqld2 online VERSION +SHOW VARIABLES LIKE 'port'; +Variable_name Value +port 9312 +STOP INSTANCE mysqld2; +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 offline +SHOW INSTANCE STATUS mysqld1; +instance_name status version +mysqld1 online VERSION +SHOW INSTANCE STATUS mysqld2; +instance_name status version +mysqld2 offline VERSION +START INSTANCE mysqld3; +ERROR HY000: Bad instance name. Check that the instance with such a name exists +START INSTANCE mysqld1; +ERROR HY000: The instance is already started +STOP INSTANCE mysqld3; +ERROR HY000: Bad instance name. Check that the instance with such a name exists +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 offline +Killing the process... +Sleeping... +Success: the process was restarted. +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 offline +START INSTANCE mysqld2; +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 online +Killing the process... +Sleeping... +Success: the process was killed. +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 offline diff --git a/mysql-test/r/im_options_set.result b/mysql-test/r/im_options_set.result new file mode 100644 index 00000000000..0d2fa699fc7 --- /dev/null +++ b/mysql-test/r/im_options_set.result @@ -0,0 +1,20 @@ +server_id =1 +server_id =2 +SHOW VARIABLES LIKE 'server_id'; +Variable_name Value +server_id 1 +SET mysqld1.server_id = 11; +server_id =11 +server_id =2 +SHOW VARIABLES LIKE 'server_id'; +Variable_name Value +server_id 1 +SET mysqld2.server_id = 12; +server_id =11 +server_id =12 +FLUSH INSTANCES; +server_id =11 +server_id =12 +SHOW VARIABLES LIKE 'server_id'; +Variable_name Value +server_id 1 diff --git a/mysql-test/r/im_options_unset.result b/mysql-test/r/im_options_unset.result new file mode 100644 index 00000000000..834152c35d2 --- /dev/null +++ b/mysql-test/r/im_options_unset.result @@ -0,0 +1,15 @@ +server_id =1 +server_id =2 +SHOW VARIABLES LIKE 'server_id'; +Variable_name Value +server_id 1 +UNSET mysqld1.server_id; +server_id =2 +SHOW VARIABLES LIKE 'server_id'; +Variable_name Value +server_id 1 +UNSET mysqld2.server_id; +FLUSH INSTANCES; +SHOW VARIABLES LIKE 'server_id'; +Variable_name Value +server_id 1 diff --git a/mysql-test/r/im_utils.result b/mysql-test/r/im_utils.result new file mode 100644 index 00000000000..fbfaeaebcac --- /dev/null +++ b/mysql-test/r/im_utils.result @@ -0,0 +1,91 @@ +SHOW INSTANCES; +instance_name status +mysqld1 online +mysqld2 offline +SHOW INSTANCE OPTIONS mysqld1; +option_name value +instance_name VALUE +mysqld-path VALUE +socket VALUE +pid-file VALUE +port VALUE +datadir VALUE +log VALUE +log-error VALUE +log-slow-queries VALUE +language VALUE +character-sets-dir VALUE +basedir VALUE +server_id VALUE +skip-stack-trace VALUE +skip-innodb VALUE +skip-bdb VALUE +skip-ndbcluster VALUE +SHOW INSTANCE OPTIONS mysqld2; +option_name value +instance_name VALUE +mysqld-path VALUE +nonguarded VALUE +socket VALUE +pid-file VALUE +port VALUE +datadir VALUE +log VALUE +log-error VALUE +log-slow-queries VALUE +language VALUE +character-sets-dir VALUE +basedir VALUE +server_id VALUE +skip-stack-trace VALUE +skip-innodb VALUE +skip-bdb VALUE +skip-ndbcluster VALUE +START INSTANCE mysqld2; +STOP INSTANCE mysqld2; +SHOW mysqld1 LOG FILES; +Logfile Path File size +ERROR LOG PATH FILE_SIZE +GENERAL LOG PATH FILE_SIZE +SLOW LOG PATH FILE_SIZE +SHOW mysqld2 LOG FILES; +Logfile Path File size +ERROR LOG PATH FILE_SIZE +GENERAL LOG PATH FILE_SIZE +SLOW LOG PATH FILE_SIZE +SHOW mysqld1 LOG ERROR 10; +Log +LOG_DATA +SHOW mysqld1 LOG SLOW 10; +Log +LOG_DATA +SHOW mysqld1 LOG GENERAL 10; +Log +LOG_DATA +SHOW mysqld1 LOG ERROR 10, 2; +Log +LOG_DATA +SHOW mysqld1 LOG SLOW 10, 2; +Log +LOG_DATA +SHOW mysqld1 LOG GENERAL 10, 2; +Log +LOG_DATA +SHOW mysqld2 LOG ERROR 10; +Log +LOG_DATA +SHOW mysqld2 LOG SLOW 10; +Log +LOG_DATA +SHOW mysqld2 LOG GENERAL 10; +Log +LOG_DATA +SHOW mysqld2 LOG ERROR 10, 2; +Log +LOG_DATA +SHOW mysqld2 LOG SLOW 10, 2; +Log +LOG_DATA +SHOW mysqld2 LOG GENERAL 10, 2; +Log +LOG_DATA diff --git a/mysql-test/t/im_daemon_life_cycle-im.opt b/mysql-test/t/im_daemon_life_cycle-im.opt new file mode 100644 index 00000000000..6bfd9a24107 --- /dev/null +++ b/mysql-test/t/im_daemon_life_cycle-im.opt @@ -0,0 +1,2 @@ +--run-as-service +--log=$MYSQL_TEST_DIR/var/log/im.log diff --git a/mysql-test/t/im_daemon_life_cycle.imtest b/mysql-test/t/im_daemon_life_cycle.imtest new file mode 100644 index 00000000000..87388d7c1e6 --- /dev/null +++ b/mysql-test/t/im_daemon_life_cycle.imtest @@ -0,0 +1,15 @@ +########################################################################### +# +# This file contains test for (1.2) test suite. +# +# Consult WL#2789 for more information. +# +########################################################################### + +--source include/im_check_os.inc + +########################################################################### + +SHOW INSTANCES; + +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest new file mode 100644 index 00000000000..fff57e16eab --- /dev/null +++ b/mysql-test/t/im_life_cycle.imtest @@ -0,0 +1,141 @@ +########################################################################### +# +# This file contains test for (1.1) test suite. +# +# Consult WL#2789 for more information. +# +########################################################################### + +--source include/im_check_os.inc + +########################################################################### +# +# 1.1.1. Check that Instance Manager is able: +# - to read definitions of two mysqld-instances; +# - to start the first instance; +# - to understand 'nonguarded' option and keep the second instance down; +# +########################################################################### + +SHOW INSTANCES; +--replace_column 3 VERSION +SHOW INSTANCE STATUS mysqld1; +--replace_column 3 VERSION +SHOW INSTANCE STATUS mysqld2; + +########################################################################### +# +# 1.1.2. Check 'START INSTANCE' command: +# - start the second instance; +# - check that it is reported as online; +# - execute some SQL-statement on mysqld2 to ensure that it is really up and +# running; +# +########################################################################### + +START INSTANCE mysqld2; +# FIXME +--sleep 3 + +SHOW INSTANCES; +--replace_column 3 VERSION +SHOW INSTANCE STATUS mysqld1; +--replace_column 3 VERSION +SHOW INSTANCE STATUS mysqld2; + +--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK) +--connection mysql_con + +SHOW VARIABLES LIKE 'port'; + +--connection default +--disconnect mysql_con + +########################################################################### +# +# 1.1.3. Check 'STOP INSTANCE' command: +# - stop the second instance; +# - check that it is reported as offline; +# - TODO: try to execute some SQL-statement to ensure that it is really down; +# +########################################################################### + +STOP INSTANCE mysqld2; +# FIXME +--sleep 3 + +SHOW INSTANCES; +--replace_column 3 VERSION +SHOW INSTANCE STATUS mysqld1; +--replace_column 3 VERSION +SHOW INSTANCE STATUS mysqld2; + +########################################################################### +# +# 1.1.4. Check that Instance Manager reports correct errors for 'START +# INSTANCE' command: +# - if the client tries to start unregistered instance; +# - if the client tries to start already started instance; +# - if the client submits invalid arguments; +# +########################################################################### + +--error 3000 +START INSTANCE mysqld3; + +--error 3002 +START INSTANCE mysqld1; + +# FIXME TODO +# BUG#12813: START/STOP INSTANCE commands accept a list as argument +# START INSTANCE mysqld1, mysqld2; + +########################################################################### +# +# 1.1.5. Check that Instance Manager reports correct errors for 'STOP INSTANCE' +# command: +# - if the client tries to start unregistered instance; +# - if the client tries to start already stopped instance; +# - if the client submits invalid arguments; +# +########################################################################### + +--error 3000 +STOP INSTANCE mysqld3; + +# TODO: IM should be fixed. +# BUG#12673: Instance Manager allows to stop the instance many times +# --error 3002 +# STOP INSTANCE mysqld2; + +# FIXME TODO +# BUG#12813: START/STOP INSTANCE commands accept a list as argument +# STOP INSTANCE mysqld1, mysqld2; + +########################################################################### +# +# 1.1.6. Check that Instance Manager is able to restart guarded instances. +# +########################################################################### + +SHOW INSTANCES; + +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted + +########################################################################### +# +# 1.1.7. Check that Instance Manager does not restart non-guarded instance. +# +########################################################################### + +SHOW INSTANCES; + +START INSTANCE mysqld2; +# FIXME +--sleep 3 + +SHOW INSTANCES; + +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed + +SHOW INSTANCES; diff --git a/mysql-test/t/im_options_set.imtest b/mysql-test/t/im_options_set.imtest new file mode 100644 index 00000000000..785c6d05fef --- /dev/null +++ b/mysql-test/t/im_options_set.imtest @@ -0,0 +1,142 @@ +########################################################################### +# +# This file contains test for (3) test suite. +# +# Consult WL#2789 for more information. +# +########################################################################### + +# +# Check the options-management commands: +# - SET; +# - FLUSH INSTANCES; +# +# Let's test the commands on the option 'server_id'. It's expected that +# originally the instances have the following server ids: +# - mysqld1: 1 +# - mysqld2: 2 +# +# 1. SET <instance_id>.server_id= SERVER_ID); where SERVER_ID is 11 or 12. +# 1.1. check that the configuration file has been updated (i.e. contains +# server_id=SERVER_ID for the instance); +# 1.2. (for mysqld1) check that the running instance has not been affected: +# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id'' +# returns zero; +# 1.3. check that internal cache of Instance Manager has not been affected +# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value). +# +# 2. FLUSH INSTANCES; +# 2.1. check that the configuration file has not been updated; +# 2.2. (for mysqld1) check that the running instance has not been affected: +# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id'' +# returns zero value; +# 2.3. check that internal cache of Instance Manager has been updated (i.e. +# SHOW INSTANCE OPTIONS <instance> contains 'server_id=SERVER_ID' line). +# +# 3. Restore options. +# + +########################################################################### + +--source include/im_check_os.inc + +########################################################################### +# +# 0. Check starting conditions. +# +########################################################################### + +# - check the configuration file; + +--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ; + +# - check the running instances. + +--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK) + +--connection mysql1_con + +SHOW VARIABLES LIKE 'server_id'; + +--connection default + +# - check the internal cache. +# TODO: we should check only server_id option here. + +# SHOW INSTANCE OPTIONS mysqld1; +# SHOW INSTANCE OPTIONS mysqld2; + +########################################################################### +# +# 1. SET <instance_id>.server_id= SERVER_ID); where SERVER_ID is 11 or 12. +# +########################################################################### + +# * mysqld1 + +SET mysqld1.server_id = 11; + +# - check that the configuration file has been updated (i.e. contains +# server_id=SERVER_ID for the instance); + +--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ; + +# - (for mysqld1) check that the running instance has not been affected: +# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id'' +# returns zero; + +--connection mysql1_con + +SHOW VARIABLES LIKE 'server_id'; + +--connection default + +# - check that internal cache of Instance Manager has not been affected +# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value). +# TODO: we should check only server_id option here. + +# SHOW INSTANCE OPTIONS mysqld1; + +# * mysqld2 + +SET mysqld2.server_id = 12; + +# - check that the configuration file has been updated (i.e. contains +# server_id=SERVER_ID for the instance); + +--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ; + +# - check that internal cache of Instance Manager has not been affected +# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value). +# TODO: we should check only server_id option here. + +# SHOW INSTANCE OPTIONS mysqld2; + +########################################################################### +# +# 2. FLUSH INSTANCES; +# +########################################################################### + +FLUSH INSTANCES; + +# - check that the configuration file has not been updated; + +--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ; + +# - (for mysqld1) check that the running instance has not been affected: +# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id'' +# returns zero value; + +--connection mysql1_con + +SHOW VARIABLES LIKE 'server_id'; + +--connection default + +# - check that internal cache of Instance Manager has been updated (i.e. +# SHOW INSTANCE OPTIONS <instance> contains 'server_id=' line). +# TODO: we should check only server_id option here. + +# SHOW INSTANCE OPTIONS mysqld1; +# SHOW INSTANCE OPTIONS mysqld2; diff --git a/mysql-test/t/im_options_unset.imtest b/mysql-test/t/im_options_unset.imtest new file mode 100644 index 00000000000..74ec42ac3f9 --- /dev/null +++ b/mysql-test/t/im_options_unset.imtest @@ -0,0 +1,150 @@ +########################################################################### +# +# This file contains test for (3) test suite. +# +# Consult WL#2789 for more information. +# +########################################################################### + +# +# Check the options-management commands: +# - UNSET; +# - FLUSH INSTANCES; +# +# Let's test the commands on the option 'server_id'. It's expected that +# originally the instances have the following server ids: +# - mysqld1: 1 +# - mysqld2: 2 +# +# The test case: +# +# 1. UNSET <instance_id>.server_id; +# +# Do the step for both instances. +# +# 1.1. check that the configuration file has been updated (i.e. does not +# contain 'server_id=' line for the instance); +# 1.2. (for mysqld1) check that the running instance has not been affected: +# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id'' +# returns non-zero value; +# 1.3. check that internal cache of Instance Manager is not affected (i.e. +# SHOW INSTANCE OPTIONS <instance> contains non-zero value for server_id); +# +# 2. FLUSH INSTANCES; +# +# Do the step for both instances. +# +# 2.1. check that the configuration file has not been updated (i.e. does not +# contain 'server_id=' for the instance); +# 2.2. (for mysqld1) check that the running instance has not been affected: +# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id'' +# returns non-zero value; +# 2.3. check that internal cache of Instance Manager has been updated (i.e. +# SHOW INSTANCE OPTIONS <instance> does not contain 'server_id=' line). +# + +########################################################################### + +--source include/im_check_os.inc + +########################################################################### +# +# 0. Check starting conditions. +# +########################################################################### + +# - check the configuration file; + +--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ; + +# - check the running instances. + +--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK) + +--connection mysql1_con + +SHOW VARIABLES LIKE 'server_id'; + +--connection default + +# - check the internal cache. +# TODO: we should check only server_id option here. + +# SHOW INSTANCE OPTIONS mysqld1; +# SHOW INSTANCE OPTIONS mysqld2; + +########################################################################### +# +# 1. UNSET <instance_id>.server_id; +# +########################################################################### + +# * mysqld1 + +UNSET mysqld1.server_id; + +# - check that the configuration file has been updated (i.e. does not +# contain 'server_id=' line for the instance); + +--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ; + +# - check that the running instance has not been affected: connect to the +# instance and check that 'SHOW VARIABLES LIKE 'server_id'' returns non-zero +# value; + +--connection mysql1_con + +SHOW VARIABLES LIKE 'server_id'; + +--connection default + +# - check that internal cache of Instance Manager is not affected (i.e. SHOW +# INSTANCE OPTIONS <instance> contains non-zero value for server_id); +# TODO: we should check only server_id option here. + +# SHOW INSTANCE OPTIONS mysqld1; + +# * mysqld2 + +UNSET mysqld2.server_id; + +# - check that the configuration file has been updated (i.e. does not +# contain 'server_id=' line for the instance); + +--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf || true; + +# - check that internal cache of Instance Manager is not affected (i.e. SHOW +# INSTANCE OPTIONS <instance> contains non-zero value for server_id); +# TODO: we should check only server_id option here. + +# SHOW INSTANCE OPTIONS mysqld2; + +########################################################################### +# +# 2. FLUSH INSTANCES; +# +########################################################################### + +FLUSH INSTANCES; + +# - check that the configuration file has not been updated (i.e. does not +# contain 'server_id=' for the instance); + +--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf || true; + +# - (for mysqld1) check that the running instance has not been affected: +# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id'' +# returns non-zero value; + +--connection mysql1_con + +SHOW VARIABLES LIKE 'server_id'; + +--connection default + +# - check that internal cache of Instance Manager has been updated (i.e. +# SHOW INSTANCE OPTIONS <instance> does not contain 'server_id=' line). +# TODO: we should check only server_id option here. + +# SHOW INSTANCE OPTIONS mysqld1; +# SHOW INSTANCE OPTIONS mysqld2; diff --git a/mysql-test/t/im_utils.imtest b/mysql-test/t/im_utils.imtest new file mode 100644 index 00000000000..dc6fb93c4ff --- /dev/null +++ b/mysql-test/t/im_utils.imtest @@ -0,0 +1,115 @@ +########################################################################### +# +# This file contains test for (2) test suite. +# +# Consult WL#2789 for more information. +# +########################################################################### + +--source include/im_check_os.inc + +########################################################################### + +# +# Check starting conditions. This test case assumes that: +# - two mysqld-instances are registered; +# - the first instance is online; +# - the second instance is offline; +# + +SHOW INSTANCES; + +# +# Check 'SHOW INSTANCE OPTIONS' command: +# - check that options of both offline and online instances are accessible; +# - since configuration of an mysqld-instance contains directories, we should +# completely ignore the second column (values) in order to make the test +# case produce the same results on different installations; +# TODO: ignore values of only directory-specific options. +# + +--replace_column 2 VALUE +SHOW INSTANCE OPTIONS mysqld1; + +--replace_column 2 VALUE +SHOW INSTANCE OPTIONS mysqld2; + +# +# Before checking log files, we should start the second instance (mysqld2) to +# give it a chance to create log files. +# + +START INSTANCE mysqld2; + +# FIXME +-- sleep 3 + +STOP INSTANCE mysqld2; + +# +# Check 'SHOW LOG FILES' command: +# - check that log files of both offline and online instances are accessible; +# - since placement of the log files is installation-specific, we should +# ignore it in comparisson; +# - also, we should ignore log file size, since it may depend on the version +# being tested; +# + +--replace_column 2 PATH 3 FILE_SIZE +SHOW mysqld1 LOG FILES; + +--replace_column 2 PATH 3 FILE_SIZE +SHOW mysqld2 LOG FILES; + +# +# Check 'SHOW LOG' command: +# - check that all three kinds of logs are available for both offline and +# online instances; +# - we should ignore the value, because it is very specific and depends on +# many factors; we only check that Instance Manager is able to provide log +# files. +# + +# mysqld1 (online) w/o the optional argument. + +--replace_column 1 LOG_DATA +SHOW mysqld1 LOG ERROR 10; + +--replace_column 1 LOG_DATA +SHOW mysqld1 LOG SLOW 10; + +--replace_column 1 LOG_DATA +SHOW mysqld1 LOG GENERAL 10; + +# mysqld1 (online) with the optional argument. + +--replace_column 1 LOG_DATA +SHOW mysqld1 LOG ERROR 10, 2; + +--replace_column 1 LOG_DATA +SHOW mysqld1 LOG SLOW 10, 2; + +--replace_column 1 LOG_DATA +SHOW mysqld1 LOG GENERAL 10, 2; + +# mysqld2 (offline) w/o the optional argument. + +--replace_column 1 LOG_DATA +SHOW mysqld2 LOG ERROR 10; + +--replace_column 1 LOG_DATA +SHOW mysqld2 LOG SLOW 10; + +--replace_column 1 LOG_DATA +SHOW mysqld2 LOG GENERAL 10; + +# mysqld2 (offline) with the optional argument. + +--replace_column 1 LOG_DATA +SHOW mysqld2 LOG ERROR 10, 2; + +--replace_column 1 LOG_DATA +SHOW mysqld2 LOG SLOW 10, 2; + +--replace_column 1 LOG_DATA +SHOW mysqld2 LOG GENERAL 10, 2; diff --git a/mysql-test/t/kill_n_check.sh b/mysql-test/t/kill_n_check.sh new file mode 100755 index 00000000000..7fe30c4774c --- /dev/null +++ b/mysql-test/t/kill_n_check.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +if [ $# -ne 2 ]; then + echo "Usage: kill_n_check.sh <pid file path> killed|restarted" + exit 0 +fi + +pid_path="$1" +expected_result="$2" + +if [ -z "$pid_path" -o ! -r "$pid_path" ]; then + echo "Error: invalid PID path ($pid_path) or PID file does not exist." + exit 0 +fi + +if [ "$expected_result" != "killed" -a \ + "$expected_result" != "restarted" ]; then + echo "Error: expected result must be either 'killed' or 'restarted'." + exit 0 +fi + +# echo "PID path: '$pid_path'" + +original_pid=`cat "$pid_path"` + +# echo "Original PID: $original_pid" + +echo "Killing the process..." + +kill -9 $original_pid + +echo "Sleeping..." + +sleep 3 + +new_pid="" + +[ -r "$pid_path" ] && new_pid=`cat "$pid_path"` + +# echo "New PID: $new_pid" + +if [ "$expected_result" == "restarted" ]; then + + if [ -z "$new_pid" ]; then + echo "Error: the process was killed." + exit 0 + fi + + if [ "$original_pid" -eq "$new_pid" ]; then + echo "Error: the process was not restarted." + exit 0 + fi + + echo "Success: the process was restarted." + exit 0 + +else # $expected_result == killed + + if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then + echo "Error: the process was restarted." + exit 0 + fi + + echo "Success: the process was killed." + exit 0 +fi |