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