1
let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
3
###########################################################################
5
# This file contains test for (1.1) test suite.
7
# Consult WL#2789 for more information.
9
###########################################################################
11
--source suite/im/t/im_check_env.inc
13
###########################################################################
15
# 1.1.2. Check 'START INSTANCE' command:
16
# - start the second instance;
17
# - check that it is reported as online;
18
# - execute some SQL-statement on mysqld2 to ensure that it is really up and
21
###########################################################################
24
--echo --------------------------------------------------------------------
26
--echo --------------------------------------------------------------------
28
START INSTANCE mysqld2;
29
# FIXME: START INSTANCE should be synchronous.
30
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
32
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
33
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
34
# its pid file is not enough, because it is unknown when IM detects that
38
--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
39
--connection mysql_con
41
--replace_result $IM_MYSQLD2_PORT IM_MYSQLD2_PORT
42
SHOW VARIABLES LIKE 'port';
45
--disconnect mysql_con
47
###########################################################################
49
# 1.1.3. Check 'STOP INSTANCE' command:
50
# - stop the second instance;
51
# - check that it is reported as offline;
52
# - TODO: try to execute some SQL-statement to ensure that it is really down;
54
###########################################################################
57
--echo --------------------------------------------------------------------
59
--echo --------------------------------------------------------------------
61
STOP INSTANCE mysqld2;
62
# FIXME: STOP INSTANCE should be synchronous.
63
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_life_cycle
65
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
66
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
67
# its pid file is not enough, because it is unknown when IM detects that
71
###########################################################################
73
# 1.1.4. Check that Instance Manager reports correct errors for 'START
75
# - if the client tries to start unregistered instance;
76
# - if the client tries to start already started instance;
77
# - if the client submits invalid arguments;
79
###########################################################################
82
--echo --------------------------------------------------------------------
84
--echo --------------------------------------------------------------------
86
--error 3000 # ER_BAD_INSTANCE_NAME
87
START INSTANCE mysqld3;
89
--error 3002 # ER_INSTANCE_ALREADY_STARTED
90
START INSTANCE mysqld1;
92
###########################################################################
94
# 1.1.5. Check that Instance Manager reports correct errors for
95
# 'STOP INSTANCE' command:
96
# - if the client tries to start unregistered instance;
97
# - if the client tries to start already stopped instance;
98
# - if the client submits invalid arguments;
100
###########################################################################
103
--echo --------------------------------------------------------------------
105
--echo --------------------------------------------------------------------
107
--error 3000 # ER_BAD_INSTANCE_NAME
108
STOP INSTANCE mysqld3;
110
# TODO: IM should be fixed.
111
# BUG#12673: Instance Manager allows to stop the instance many times
112
# --error 3002 # ER_INSTANCE_ALREADY_STARTED
113
# STOP INSTANCE mysqld2;
115
###########################################################################
117
# 1.1.6. Check that Instance Manager is able to restart guarded instances.
119
###########################################################################
122
--echo --------------------------------------------------------------------
124
--echo --------------------------------------------------------------------
126
--exec $UTIL/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 im_life_cycle
128
# Give some time to IM to detect that mysqld was restarted. It should be
129
# longer than monitoring interval.
135
###########################################################################
137
# 1.1.7. Check that Instance Manager does not restart non-guarded instance.
139
###########################################################################
142
--echo --------------------------------------------------------------------
144
--echo --------------------------------------------------------------------
146
START INSTANCE mysqld2;
147
# FIXME: START INSTANCE should be synchronous.
148
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
150
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
151
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
152
# its pid file is not enough, because it is unknown when IM detects that
153
# mysqld has started.
156
--exec $UTIL/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 im_life_cycle
158
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
159
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
160
# its pid file is not enough, because it is unknown when IM detects that
161
# mysqld has started.
164
###########################################################################
166
# 1.1.8. Check that Instance Manager returns an error on
167
# incomplete SHOW INSTANCE STATUS command.
169
###########################################################################
172
--echo --------------------------------------------------------------------
174
--echo --------------------------------------------------------------------
176
--error ER_SYNTAX_ERROR
177
SHOW INSTANCE STATUS;
180
# Tests for bug fixes
184
# Bug #12813 Instance Manager: START/STOP INSTANCE commands accept
185
# a list as argument.
189
--echo --------------------------------------------------------------------
191
--echo --------------------------------------------------------------------
193
--error ER_SYNTAX_ERROR
194
START INSTANCE mysqld1,mysqld2,mysqld3;
196
--error ER_SYNTAX_ERROR
197
STOP INSTANCE mysqld1,mysqld2,mysqld3;
200
# Bug #12673: Instance Manager: allows to stop the instance many times
203
STOP INSTANCE mysqld2;
205
--echo End of 5.0 tests