Debian Codegraph @

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

raw
1 # Test a values of compression capabilities
2
3 --source include/xplugin_preamble.inc
4 --source include/xplugin_create_user.inc
5
6
7 --write_file $MYSQL_TMP_DIR/capabilities_compression.xpl
8 -->import connection.macro
9 -->quiet
10 -->callmacro Verify_its_xprotocol_connection
11
12 -->macro Set_commpresion_capabilities_1 %KEY1% %VALUE1% %RESULT%
13 -->echo ##########################################################
14 -->echo ## Scenario: %KEY1%=%VALUE1%
15
16 Mysqlx.Connection.CapabilitiesSet {
17 capabilities {
18 capabilities {
19 name: "compression"
20 value {
21 type: OBJECT
22 obj {
23 fld {
24 key: "%KEY1%"
25 value {
26 type: SCALAR
27 scalar {
28 type: V_STRING
29 v_string {
30 value: "%VALUE1%"
31 }
32 }
33 }
34 }
35 }
36 }
37 }
38 }
39 }
40 -->recvtype %RESULT%
41 -->endmacro
42
43
44
45 -->callmacro Set_commpresion_capabilities_1 algorithm deflate_stream Mysqlx.Ok
46 -->callmacro Set_commpresion_capabilities_1 algorithm lz4_message Mysqlx.Ok
47 -->callmacro Set_commpresion_capabilities_1 algorithm zstd_stream Mysqlx.Ok
48 -->callmacro Set_commpresion_capabilities_1 algorithm wrong Mysqlx.Error
49 -->callmacro Set_commpresion_capabilities_1 wrong deflate_stream Mysqlx.Error
50
51 EOF
52
53
54 --write_file $MYSQL_TMP_DIR/configured_only_on_server.xpl
55 -->import connection.macro
56 -->quiet
57 -->callmacro Verify_its_xprotocol_connection
58
59 Mysqlx.Connection.CapabilitiesSet {
60 capabilities {
61 capabilities {
62 name: "compression"
63 value {
64 type: OBJECT
65 obj {
66 fld {
67 key: "algorithm"
68 value {
69 type: SCALAR
70 scalar {
71 type: V_STRING
72 v_string {
73 value: "deflate_stream"
74 }
75 }
76 }
77 }
78 }
79 }
80 }
81 }
82 }
83 -->recvtype Mysqlx.Ok
84
85 -->login x_root
86
87 -->expecterror 2512
88 SELECT 1;
89 EOF
90
91
92 --write_file $MYSQL_TMP_DIR/invalid_capability.xpl
93 -->import connection.macro
94 -->quiet
95 -->callmacro Verify_its_xprotocol_connection
96
97 -->echo
98 -->echo #
99 -->echo # I.3.a
100 Mysqlx.Connection.CapabilitiesSet {
101 capabilities {
102 capabilities {
103 name: "compression"
104 value {
105 type: OBJECT
106 obj {
107 }
108 }
109 }
110 }
111 }
112 -->recvtype Mysqlx.Error
113
114 -->echo
115 -->echo #
116 -->echo # I.3.b
117 Mysqlx.Connection.CapabilitiesSet {
118 capabilities {
119 capabilities {
120 name: "compression"
121 value {
122 type: ARRAY
123 array {
124 }
125 }
126 }
127 }
128 }
129 -->recvtype Mysqlx.Error
130
131 -->echo
132 -->echo #
133 -->echo # I.3.c
134 Mysqlx.Connection.CapabilitiesSet {
135 capabilities {
136 capabilities {
137 name: "compression"
138 value {
139 type: OBJECT
140 obj {
141 fld {
142 key: "algorithm"
143 value {
144 type: ARRAY
145 array {
146 }
147 }
148 }
149 }
150 }
151 }
152 }
153 }
154 -->recvtype Mysqlx.Error
155
156 -->echo
157 -->echo #
158 -->echo # I.3.d
159 Mysqlx.Connection.CapabilitiesSet {
160 capabilities {
161 capabilities {
162 name: "compression"
163 value {
164 type: OBJECT
165 obj {
166 fld {
167 key: "algorithm"
168 value {
169 type: SCALAR
170 scalar {
171 type: V_STRING
172 v_string {
173 value: "deflate_stream"
174 }
175 }
176 }
177 }
178 fld {
179 key: "server_max_combine_messages"
180 value {
181 type: ARRAY
182 array {
183 }
184 }
185 }
186 }
187 }
188 }
189 }
190 }
191 -->recvtype Mysqlx.Error
192
193 -->echo
194 -->echo #
195 -->echo # I.3.e
196 Mysqlx.Connection.CapabilitiesSet {
197 capabilities {
198 capabilities {
199 name: "compression"
200 value {
201 type: OBJECT
202 obj {
203 fld {
204 key: "algorithm"
205 value {
206 type: SCALAR
207 scalar {
208 type: V_STRING
209 v_string {
210 value: "deflate_stream"
211 }
212 }
213 }
214 }
215 fld {
216 key: "server_combine_mixed_messages"
217 value {
218 type: ARRAY
219 array {
220 }
221 }
222 }
223 }
224 }
225 }
226 }
227 }
228 -->recvtype Mysqlx.Error
229
230 -->echo
231 -->echo #
232 -->echo # I.3.f
233 Mysqlx.Connection.CapabilitiesSet {
234 capabilities {
235 capabilities {
236 name: "compression"
237 value {
238 type: OBJECT
239 obj {
240 fld {
241 key: "algorithm"
242 value {
243 type: SCALAR
244 scalar {
245 type: V_STRING
246 v_string {
247 value: "deflate_stream"
248 }
249 }
250 }
251 }
252 fld {
253 key: "level"
254 value {
255 type: SCALAR
256 scalar {
257 type: V_STRING
258 v_string {
259 value: "1"
260 }
261 }
262 }
263 }
264 }
265 }
266 }
267 }
268 }
269 -->recvtype Mysqlx.Error
270
271 EOF
272
273 --echo
274 --echo
275 --echo ## I. Verify CapabilitySet
276 --echo #
277 --echo # 1. Check that server allows only valid algorithm names, other
278 --echo # are rejected
279 --echo # 2. Check that when compression is enabled on server side,
280 --echo # and client didn't enabled compression then an error
281 --echo # is returned by client when it received compressed message
282 --echo # 3. Check if server verifies the "compression" object in CapabilitySet
283 --echo # a. Send compression capability without any configuration
284 --echo # b. Send compression capability with invalid type (not object)
285 --echo # c. Send algorithm capability with invalid type (not scalar)
286 --echo # d. Send server_max_combine_messages capability with invalid type (not scalar)
287 --echo # e. Send server_combine_mixed_messages capability with invalid type (not scalar)
288 --echo # f. Send level capability with invalid type (not integer)
289
290 --echo
291 --echo #
292 --echo # I.1
293
294 exec $MYSQLXTEST
295 -u x_root --password='' -h127.0.0.1 --no-auth
296 --file=$MYSQL_TMP_DIR/capabilities_compression.xpl 2>&1;
297
298
299 --echo
300 --echo #
301 --echo # I.2
302 # Expect CR_X_COMPRESSION_NOT_CONFIGURED
303 # mysqlxtest doesn't know the name of CR_X_ errors, thus
304 # we use error code as number 2512
305 exec $MYSQLXTEST
306 -u x_root --password='' -h127.0.0.1 --no-auth --expect-error=2512
307 --file=$MYSQL_TMP_DIR/configured_only_on_server.xpl 2>&1;
308
309
310 --echo
311 --echo #
312 --echo # I.3
313 exec $MYSQLXTEST
314 -u x_root --password='' -h127.0.0.1 --no-auth
315 --file=$MYSQL_TMP_DIR/invalid_capability.xpl 2>&1;
316
317
318 ## Cleanup
319 --source ../include/xplugin_cleanup.inc