mariadb/mysql-test/t/im_life_cycle.imtest
unknown 0ff8d48661 Fix of test suite in scope of fixing BUG#18023: IM: instance
can be started several times; monitor interval must be > 2sec


mysql-test/r/im_daemon_life_cycle.result:
  Updated result file.
mysql-test/r/im_life_cycle.result:
  Updated result file.
mysql-test/r/im_utils.result:
  Updated result file.
mysql-test/t/im_daemon_life_cycle-im.opt:
  Set monitoring interval to 1 second in order to:
    - be consistent with 5.1;
    - speed up tests;
mysql-test/t/im_daemon_life_cycle.imtest:
  1. Use wait_for_start.sh script to minimize chance of race condition.
  2. Polishing.
mysql-test/t/im_life_cycle.imtest:
  1. Use wait_for_start.sh and wait_for_stop.sh scripts to
     minimize chance of race condition;
  2. Remove some statements, because there is no way now to
     stabilize their output.
  3. Polishing;
mysql-test/t/im_utils.imtest:
  1. Use wait_for_start.sh script to minimize chance of race condition.
  2. Polishing.
mysql-test/t/kill_n_check.sh:
  1. Make timeout configurable by command-line argument;
  2. Change algorithm of waiting for process to restart to be
     more robust.
mysql-test/t/im_life_cycle-im.opt:
  Set monitoring interval to 1 second in order to:
    - be consistent with 5.1;
    - speed up tests;
mysql-test/t/im_utils-im.opt:
  Set monitoring interval to 1 second in order to:
    - be consistent with 5.1;
    - speed up tests;
mysql-test/t/wait_for_process.sh:
  A new helper script, intended to be used instead of dummy "sleep"
  when waiting for some process to start or stop.
2006-06-19 14:13:34 +04:00

220 lines
7.2 KiB
Text

###########################################################################
#
# 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;
#
###########################################################################
--echo
--echo --------------------------------------------------------------------
--echo -- 1.1.1.
--echo --------------------------------------------------------------------
# Wait for mysqld1 (guarded instance) to start.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
# Let IM detect that mysqld1 is online. This delay should be longer than
# monitoring interval.
--sleep 3
# Check that start conditions are as expected.
SHOW INSTANCES;
###########################################################################
#
# 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;
#
###########################################################################
--echo
--echo --------------------------------------------------------------------
--echo -- 1.1.2.
--echo --------------------------------------------------------------------
START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
# synchronous. Even waiting for mysqld to start by looking at its pid file is
# not enough, because IM may not detect that mysqld has started.
# SHOW INSTANCES;
--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
--connection mysql_con
--replace_result $IM_MYSQLD2_PORT IM_MYSQLD2_PORT
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;
#
###########################################################################
--echo
--echo --------------------------------------------------------------------
--echo -- 1.1.3.
--echo --------------------------------------------------------------------
STOP INSTANCE mysqld2;
# FIXME: STOP INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped
# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
# synchronous. Even waiting for mysqld to start by looking at its pid file is
# not enough, because IM may not detect that mysqld has started.
# SHOW INSTANCES;
###########################################################################
#
# 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;
#
###########################################################################
--echo
--echo --------------------------------------------------------------------
--echo -- 1.1.4.
--echo --------------------------------------------------------------------
--error 3000 # ER_BAD_INSTANCE_NAME
START INSTANCE mysqld3;
--error 3002 # ER_INSTANCE_ALREADY_STARTED
START INSTANCE mysqld1;
###########################################################################
#
# 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;
#
###########################################################################
--echo
--echo --------------------------------------------------------------------
--echo -- 1.1.5.
--echo --------------------------------------------------------------------
--error 3000 # ER_BAD_INSTANCE_NAME
STOP INSTANCE mysqld3;
# TODO: IM should be fixed.
# BUG#12673: Instance Manager allows to stop the instance many times
# --error 3002 # ER_INSTANCE_ALREADY_STARTED
# STOP INSTANCE mysqld2;
###########################################################################
#
# 1.1.6. Check that Instance Manager is able to restart guarded instances.
#
###########################################################################
--echo
--echo --------------------------------------------------------------------
--echo -- 1.1.6.
--echo --------------------------------------------------------------------
SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30
# Give some time to IM to detect that mysqld was restarted. It should be longer
# than monitoring interval.
--sleep 3
SHOW INSTANCES;
###########################################################################
#
# 1.1.7. Check that Instance Manager does not restart non-guarded instance.
#
###########################################################################
--echo
--echo --------------------------------------------------------------------
--echo -- 1.1.7.
--echo --------------------------------------------------------------------
START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
# synchronous. Even waiting for mysqld to start by looking at its pid file is
# not enough, because IM may not detect that mysqld has started.
# SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10
# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
# synchronous. Even waiting for mysqld to start by looking at its pid file is
# not enough, because IM may not detect that mysqld has started.
# SHOW INSTANCES;
###########################################################################
#
# 1.1.8. Check that Instance Manager returns an error on
# incomplete SHOW INSTANCE STATUS command.
#
###########################################################################
--echo
--echo --------------------------------------------------------------------
--echo -- 1.1.8.
--echo --------------------------------------------------------------------
--error ER_SYNTAX_ERROR
SHOW INSTANCE STATUS;
#
# Tests for bug fixes
#
#
# Bug #12813 Instance Manager: START/STOP INSTANCE commands accept
# a list as argument.
#
--echo
--echo --------------------------------------------------------------------
--echo -- BUG#12813
--echo --------------------------------------------------------------------
--error ER_SYNTAX_ERROR
START INSTANCE mysqld1,mysqld2,mysqld3;
--error ER_SYNTAX_ERROR
STOP INSTANCE mysqld1,mysqld2,mysqld3;