Debian Codegraph @

mysql-test/suite/x/t/message_compressed_empty.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/too_large.xpl
7 -->import wait_until_disconnect.macro
8 -->import connection.macro
9 -->import assert_status_variable.macro
10
11 -->macro New_session_with_compression
12 newsession SOME_SESSION -;
13 -->quiet
14 callmacro Verify_its_xprotocol_connection;
15 Mysqlx.Connection.CapabilitiesSet {
16 capabilities {
17 capabilities {
18 name: "compression"
19 value {
20 type: OBJECT
21 obj {
22 fld {
23 key: "algorithm"
24 value {
25 type: SCALAR
26 scalar {
27 type: V_STRING
28 v_string {
29 value: "%OPTION_COMPRESSION_ALGORITHM%"
30 }
31 }
32 }
33 }
34 }
35 }
36 }
37 }
38 }
39 recvok;
40 enable_compression %OPTION_COMPRESSION_ALGORITHM%;
41 login;
42 -->noquiet
43 -->endmacro
44
45 -->macro Execute_invalid_message %MSG%
46 callmacro New_session_with_compression;
47
48 hexsend %MSG%;
49 recverror ER_X_BAD_COMPRESSED_FRAME;
50
51 noquiet;
52 echo ## Waiting for disconnection;
53 callmacro Wait_until_disconnect;
54 -->quiet
55 -->endmacro
56
57 -->echo
58 -->echo ## 1. Send empty compressed frame
59 -->echo ## 2. Send empty compressed payload
60 -->echo ## 3. Send empty single-compressed frame and check its processed
61 -->echo ## 4. Send empty compressed frame with invalid uncompressed-size field
62 -->echo ## 5. Send empty compressed frame with invalid client_messages field
63 -->echo ## 6. Send empty compressed frame with unknown field of group type
64 -->echo ## 7. Send empty compressed frame with invalid payload field
65 -->echo ## 8. Send empty compressed frame with unknown field
66 -->echo #
67
68 -->echo
69 -->echo # 1.
70 #
71 # length=1, Mysqlx.Compression
72 callmacro Execute_invalid_message 010000002E;
73
74 -->echo;
75 -->echo # 2
76 -->hexparse %MSG_COMP_HEX% Mysqlx.Connection.Compression {
77 payload:""
78 }
79 echo %MSG_COMP_HEX%;
80 callmacro Execute_invalid_message %MSG_COMP_HEX%;
81
82 -->echo;
83 -->echo # 3.
84
85 callmacro New_session_with_compression;
86 -->binparse %DATA% Mysqlx.Expect.Open {
87 }
88 compress_bin %COMPRESSED% %DATA%;
89
90 callmacro Assert_status_variable Mysqlx_expect_open 0;
91
92 Mysqlx.Connection.Compression {
93 uncompressed_size: 1000
94 payload:"%COMPRESSED%"
95 }
96 recvok;
97
98 callmacro Assert_status_variable Mysqlx_expect_open 1;
99 closesession SOME_SESSION;
100
101 -->echo
102 -->echo # 4.
103 #
104 # length=2, Mysqlx.Compression, invalid uncompressed_size
105 callmacro Execute_invalid_message 020000002E08;
106
107 -->echo
108 -->echo # 5.
109 #
110 # length=2, Mysqlx.Compression, invalid client_messages
111 callmacro Execute_invalid_message 020000002E10;
112
113
114 -->echo
115 -->echo # 6.
116 #
117 # length=2, Mysqlx.Compression, invalid client_messages
118 callmacro Execute_invalid_message 020000002E53;
119
120
121 -->echo
122 -->echo # 7.
123 #
124 # length=2, Mysqlx.Compression, invalid payload
125 callmacro Execute_invalid_message 020000002E04;
126
127 -->echo
128 -->echo # 8.
129 #
130 # length=3, Mysqlx.Compression, unknown payload
131 callmacro Execute_invalid_message 030000002E2400;
132
133 EOF
134
135 # Set the timeout for connection to 300 seconds
136 # which is must be greater than the peerdisc/timeout
137 SET GLOBAL mysqlx_connect_timeout = 300;
138 SET GLOBAL mysqlx_wait_timeout = 300;
139 SET GLOBAL mysqlx_max_allowed_packet = 1000;
140
141 echo;
142 echo ## A. Execute the test using "deflate" algorithm;
143 echo #;
144 --replace_regex /payload: *\".*\"/payload: "BINARY"/
145 exec $MYSQLXTEST
146 -u x_root
147 --compression-mode=required
148 --compression-algorithm=deflate_stream
149 --file=$MYSQL_TMP_DIR/too_large.xpl 2>&1;
150
151 echo;
152 echo ## B. Execute the test using "lz4" algorithm;
153 echo #;
154 --replace_regex /payload: *\".*\"/payload: "BINARY"/
155 exec $MYSQLXTEST
156 -u x_root
157 --compression-mode=required
158 --compression-algorithm=lz4_message
159 --file=$MYSQL_TMP_DIR/too_large.xpl 2>&1;
160
161
162 echo;
163 echo ## C. Execute the test using "zstd" algorithm;
164 echo #;
165 --replace_regex /payload: *\".*\"/payload: "BINARY"/
166 exec $MYSQLXTEST
167 -u x_root
168 --compression-mode=required
169 --compression-algorithm=zstd_stream
170 --file=$MYSQL_TMP_DIR/too_large.xpl 2>&1;
171
172 ## Cleanup
173 SET GLOBAL mysqlx_connect_timeout= DEFAULT;
174 SET GLOBAL mysqlx_wait_timeout = DEFAULT;
175 SET GLOBAL mysqlx_max_allowed_packet = DEFAULT;
176 --source ../include/xplugin_cleanup.inc