Debian Codegraph @

mysql-test/suite/x/t/expect_noerror.test

raw
1 ########### ../t/expect_noerror.test #########
2 ### #
3 ### This test runs aims to run expect.open and expect.close xmessage #
4 ### with mysqlxtest client. #
5 ### Test covers #
6 ### - check condition_key (continue on error or not) #
7 # Do not continue on error if condition_key=1,default is #
8 # to continue #
9 ### - Inherit parent's open block condition with "op" #
10 ### - Nested open/close block #
11 ### #
12 ########################################################################
13 #
14
15 --source include/xplugin_preamble.inc
16 --source include/xplugin_create_user.inc
17 ## Test starts here
18 --write_file $MYSQL_TMP_DIR/expect_noerror.xpl
19
20 -->echo Test 1
21 ###### normal case, an error within an expect block
22 # open a no_error block from scratch
23 Mysqlx.Expect.Open {
24 cond {
25 condition_key: 1
26 }
27 }
28 -->recv
29
30 Mysqlx.Sql.StmtExecute {
31 namespace : "mysqlx"
32 stmt : "ping"
33 }
34 -->recvresult
35
36 Mysqlx.Sql.StmtExecute {
37 namespace : "bla"
38 stmt : "bla"
39 }
40 # error
41 -->recv
42
43 Mysqlx.Sql.StmtExecute {
44 namespace : "mysqlx"
45 stmt : "ping"
46 }
47 # should fail with expect error now
48 -->recv
49
50 Mysqlx.Expect.Close {
51 }
52 ## Error expected
53 -->recv
54
55 Mysqlx.Sql.StmtExecute {
56 namespace : "mysqlx"
57 stmt : "ping"
58 }
59 # should pass now
60 -->recv
61
62
63 -->echo Test 2
64 ###### an error within a no-op expect block
65 Mysqlx.Expect.Open {
66 }
67 -->recv
68
69 Mysqlx.Sql.StmtExecute {
70 namespace : "mysqlx"
71 stmt : "ping"
72 }
73 # ok
74 -->recv
75
76 Mysqlx.Sql.StmtExecute {
77 namespace : "bla"
78 stmt : "bla"
79 }
80 # error
81 -->recv
82
83 Mysqlx.Sql.StmtExecute {
84 namespace : "mysqlx"
85 stmt : "ping"
86 }
87 # ok
88 -->recv
89
90 Mysqlx.Expect.Close {
91 }
92 # ok
93 -->recv
94
95
96 -->echo Test 3
97 ####### a nested error block
98 Mysqlx.Expect.Open {
99 cond {
100 condition_key: 1
101 }
102 }
103 -->recv
104
105 Mysqlx.Expect.Open {
106 cond {
107 condition_key: 1
108 }
109 }
110 -->recv
111
112 Mysqlx.Sql.StmtExecute {
113 namespace : "bogus"
114 stmt : "ping"
115 }
116 # error
117 -->recv
118
119 Mysqlx.Expect.Close {
120 }
121 # error
122 -->recv
123
124 Mysqlx.Sql.StmtExecute {
125 namespace : "mysqlx"
126 stmt : "ping"
127 }
128 # error
129 -->recv
130
131 Mysqlx.Expect.Close {
132 }
133 # error
134 -->recv
135
136 -->echo Test 4
137 ####### a nested error block
138 Mysqlx.Expect.Open {
139 }
140 -->recv
141
142 Mysqlx.Expect.Open {
143 cond {
144 condition_key: 1
145 }
146 }
147 -->recv
148
149 Mysqlx.Sql.StmtExecute {
150 namespace : "bogus"
151 stmt : "ping"
152 }
153 # error
154 -->recv
155
156 Mysqlx.Sql.StmtExecute {
157 namespace : "mysqlx"
158 stmt : "ping"
159 }
160 # error
161 -->recv
162
163 Mysqlx.Expect.Close {
164 }
165 # error
166 -->recv
167
168 Mysqlx.Sql.StmtExecute {
169 namespace : "bogus"
170 stmt : "ping"
171 }
172 # error
173 -->recv
174
175 Mysqlx.Sql.StmtExecute {
176 namespace : "mysqlx"
177 stmt : "ping"
178 }
179 # no error
180 -->recv
181
182 Mysqlx.Expect.Close {
183 }
184 # no error
185 -->recv
186
187
188
189 -->echo Test 5
190 ####### a nested error block
191 Mysqlx.Expect.Open {
192 cond {
193 condition_key: 1
194 }
195 }
196 -->recv
197
198 Mysqlx.Expect.Open {
199 }
200 -->recv
201
202 Mysqlx.Sql.StmtExecute {
203 namespace : "bogus"
204 stmt : "ping"
205 }
206 # error
207 -->recv
208 Mysqlx.Sql.StmtExecute {
209 namespace : "mysqlx"
210 stmt : "ping"
211 }
212 # no error
213 -->recv
214
215 Mysqlx.Expect.Close {
216 }
217 # no error
218 -->recv
219
220 Mysqlx.Sql.StmtExecute {
221 namespace : "mysqlx"
222 stmt : "ping"
223 }
224 # no error
225 -->recv
226 Mysqlx.Sql.StmtExecute {
227 namespace : "bogus"
228 stmt : "ping"
229 }
230 # error
231 -->recv
232 Mysqlx.Sql.StmtExecute {
233 namespace : "mysqlx"
234 stmt : "ping"
235 }
236 # error
237 -->recv
238
239
240 Mysqlx.Expect.Close {
241 }
242 # no error
243 -->recv
244
245 -->echo Test 6 : Do not inherit parent condition by default
246 Mysqlx.Expect.Open {
247 cond {
248 condition_key: 1
249 }
250 }
251 -->recv
252
253 # Do not inherit parent's condition
254 # if "op" is not given then by default it inherit's parent's condition
255 Mysqlx.Expect.Open {
256 op: EXPECT_CTX_EMPTY
257 }
258 -->recv
259
260 Mysqlx.Sql.StmtExecute {
261 namespace : "bogus"
262 stmt : "ping"
263 }
264 # error
265 -->recv
266 Mysqlx.Sql.StmtExecute {
267 namespace : "mysqlx"
268 stmt : "ping"
269 }
270 # no error
271 -->recv
272
273 Mysqlx.Expect.Close {
274 }
275 # no error
276 -->recv
277
278 Mysqlx.Sql.StmtExecute {
279 namespace : "mysqlx"
280 stmt : "ping"
281 }
282 # no error
283 -->recv
284 Mysqlx.Sql.StmtExecute {
285 namespace : "bogus"
286 stmt : "ping"
287 }
288 #error
289 -->recv
290 Mysqlx.Sql.StmtExecute {
291 namespace : "mysqlx"
292 stmt : "ping"
293 }
294 #error
295 -->recv
296
297
298 Mysqlx.Expect.Close {
299 }
300 #no error
301 -->recv
302
303 -->echo Test 7 : Inherit condition
304 # Do not inherit parent's condition when there is no parent
305 Mysqlx.Expect.Open {
306 op: EXPECT_CTX_EMPTY
307 }
308 -->recv
309 Mysqlx.Expect.Close {
310 }
311 #no error
312 -->recv
313
314 -->echo Test 8 : Inherit condition
315 # inherit parent's condition when there is no parent
316 Mysqlx.Expect.Open {
317 op: EXPECT_CTX_COPY_PREV
318 cond {
319 condition_key: 1
320 }
321 }
322 -->recv
323
324 Mysqlx.Sql.StmtExecute {
325 namespace : "mysqlx"
326 stmt : "ping"
327 }
328 # no error
329 -->recv
330 Mysqlx.Sql.StmtExecute {
331 namespace : "bogus"
332 stmt : "ping"
333 }
334 #error
335 -->recv
336 Mysqlx.Sql.StmtExecute {
337 namespace : "mysqlx"
338 stmt : "ping"
339 }
340 #error
341 -->recv
342 #
343
344 Mysqlx.Expect.Close {
345 }
346 #no error
347 -->recv
348
349
350 -->echo Test 9 : condition_key can take only value 1
351 Mysqlx.Expect.Open {
352 cond {
353 condition_key: 0
354 }
355 }
356 -->recv
357
358 Mysqlx.Expect.Open {
359 cond {
360 condition_key: 1200
361 }
362 }
363 -->recv
364
365 # try to close un-opened block
366 Mysqlx.Expect.Close {
367 }
368 -->recv
369
370 EOF
371
372 --exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/expect_noerror.xpl 2>&1
373
374 ## Cleanup
375 --source ../include/xplugin_cleanup.inc