Debian Codegraph @

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

raw
1 ## Preamble
2 --source include/xplugin_preamble.inc
3 --source include/xplugin_create_user.inc
4
5 ## TEST STARTS HERE
6 --write_file $MYSQL_TMP_DIR/validate_not_init_message.xpl
7 -->import wait_until_disconnect.macro
8
9 #
10 # The test refers to X Protocol frame defined in following way:
11 # |4 bytes |1 bytes | (Payload-size - 1) bytes.....|
12 #
13 # Where each part of it can be named differently:
14 # |4 bytes |1 bytes | (Payload-size - 1) bytes.....|
15 # |Header | Protobuf payload |
16 # |Payload-size |Payload |
17 # |Payload-size |Msg type | Protobuf payload |
18 #
19 # The test will try to send StmtExecute to server wihtout protobuf
20 # payload. Thus message has some required fields, thus they wont
21 # be iniialized. Thus should cause a disconnect on the server side
22 #
23 # client->server: XMessage with invalid payload
24 # client<-server: Mysqlx.Error(ER_X_BAD_MESSAGE)
25 # client<-server: disconnect
26 #
27 # The test needs to send only the header to server, wihtout following data
28 #
29 # * Payload-size - set to 1 (payload needs only to contain msg-type
30 # wihtout protobuf-payload (in hex 01000000)
31 # * Msg-type - Message ID of StmtExecute is "12" in hex "0C"
32 # * Protobuf-payload - empty
33 #
34 ## which gives following command: "hexsend 010000000C;"
35 #
36
37 -->echo
38 -->echo ## 1. Send invalid message to server and obeserve a disconnect.
39
40 hexsend 010000000C;
41 expecterror ER_X_BAD_MESSAGE;
42 recvresult;
43 callmacro Wait_until_disconnect;
44
45 EOF
46
47 # Set the timeout for connection to 300 seconds
48 # which is must be greater than the peerdisc/timeout
49 SET GLOBAL mysqlx_connect_timeout = 300;
50 SET GLOBAL mysqlx_wait_timeout = 300;
51
52 --let $wait_condition= SELECT variable_value = 0 FROM performance_schema.global_status WHERE variable_name LIKE 'Mysqlx_sessions_fatal_error'
53 --source include/wait_condition_or_abort.inc
54
55 --exec $MYSQLXTEST -u x_root --file=$MYSQL_TMP_DIR/validate_not_init_message.xpl 2>&1
56
57 --let $wait_condition= SELECT variable_value = 1 FROM performance_schema.global_status WHERE variable_name LIKE 'Mysqlx_sessions_fatal_error'
58 --source include/wait_condition_or_abort.inc
59
60 ## Cleanup
61 SET GLOBAL mysqlx_connect_timeout= DEFAULT;
62 SET GLOBAL mysqlx_wait_timeout = DEFAULT;
63 --source ../include/xplugin_cleanup.inc