-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathadmin_modify_collection_options.result
444 lines (333 loc) · 8.85 KB
/
admin_modify_collection_options.result
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
create schema xtest;
## I. Try to modify non existing collection.
## II. Check modify_collection_options with invalid validation field.
#
# 1. Empty validation field given.
# 2. No validation field given.
# 3. Validation contains only unknown fields.
# 4. Validation contains valid fields along with unknown fields.
# 5. Options contain invalid field.
## III. Check modify_collection_options command with the validation
# level field set.
#
# 1. Test with invalid validation level value.
# 2. Test turning on the validation.
# 3. Test turning off the validation.
# 4. Check case insensitive values for validation level setting.
## IV. Check modify_collection_options command with the validation
# schema field set.
#
# 1. Test containing invalid schema field.
# 2. Test with empty schema field.
# 3. Replace default validation schema with one provided by a user.
# 4. Set validation schema encoded as protobuf string.
# 5. Set validation schema encoded as Mysqlx.Datatypes.Object.
# 6. Check special characters handling inside a validation schema.
## V. Check modify_collection_options command with both validation
# schema and validation level fields set.
#
# 1. Set validation schema encoded as protobuf string and validation
# level set to off.
# 2. Set validation schema encoded as Mysqlx.Datatypes.Object and
# validation level set to strict.
# 3. Check modify_collection_options with custom schema and invalid
# level field value.
## VI. Check modify_collection_options command when modification fails.
#
# 1. Insert some invalid data when validation is disabled, after that
# modification must fail. Fix the offending row and modification
# should pass this time.
# 2. Modification fails on existing data, update offending row so that
# it will be in line with the new schema and try again, this time
# modify_collumn_options must pass.
# 3. Insert invalid data when validation is disabled, modify collection
# using new schema which would treat existing data as valid and
# enabling the validation.
## VII. Check Mysqlx_stmt_modify_collection_options variable.
#
# I
0 rows affected
Warnings generated:
NOTE | 1051 | Unknown table 'xtest.tab'
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 1146
msg: "Table \'xtest.tab\' doesn\'t exist"
sql_state: "42S02"
}
#
# II.1
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5020
msg: "Arguments value used under \"validation\" must be an object with at least one field"
sql_state: "HY000"
}
#
# II.2
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5016
msg: "Invalid data type for argument \'options\', expected \'object\' type"
sql_state: "HY000"
}
#
# II.3
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5021
msg: "\'foo\' is not a valid field for modify_collection_options command"
sql_state: "HY000"
}
#
# II.4
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5021
msg: "\'foo\' is not a valid field for modify_collection_options command"
sql_state: "HY000"
}
#
# II.5
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5021
msg: "\'foo\' is not a valid field for modify_collection_options command"
sql_state: "HY000"
}
#
# III.1
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5017
msg: "Invalid \"validation.level\" argument. Allowed values are \'OFF\' and \'STRICT\'"
sql_state: "HY000"
}
#
# III.2
command ok
command ok
0 rows affected
#
# III.3
command ok
command ok
0 rows affected
#
# III.4
command ok
command ok
0 rows affected
#
# IV.1
command ok
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5182
msg: "Validation schema is not a valid JSON document"
sql_state: "HY000"
}
1 rows affected
command ok
1 rows affected
0 rows affected
#
# IV.2
command ok
command ok
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 3140
msg: "Invalid JSON text: \"The document is empty.\" at position 0 in value for column \'test_coll._json_schema\'."
sql_state: "22032"
}
0 rows affected
#
# IV.3
command ok
GENERATION_EXPRESSION
_utf8mb4\'{"type":"object"}\'
0 rows affected
command ok
GENERATION_EXPRESSION
_utf8mb4\'{"id":"some id","description":"modified"}\'
0 rows affected
0 rows affected
#
# IV.4
command ok
GENERATION_EXPRESSION
_utf8mb4\'{"description":"base"}\'
0 rows affected
command ok
GENERATION_EXPRESSION
_utf8mb4\'{"description":"modified"}\'
0 rows affected
0 rows affected
#
# IV.5
command ok
command ok
GENERATION_EXPRESSION
_utf8mb4\'{"description":"modified"}\'
0 rows affected
0 rows affected
#
# IV.6
command ok
command ok
GENERATION_EXPRESSION
_utf8mb4\'{"description":"fo"o`b@\\\\"}\'
0 rows affected
0 rows affected
#
# V.1
command ok
command ok
GENERATION_EXPRESSION
_utf8mb4\'{"description":"test"}\'
0 rows affected
0 rows affected
#
# V.2
command ok
command ok
GENERATION_EXPRESSION
_utf8mb4\'{"description":"test"}\'
0 rows affected
0 rows affected
#
# V.3
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5017
msg: "Invalid \"validation.level\" argument. Allowed values are \'OFF\' and \'STRICT\'"
sql_state: "HY000"
}
#
# VI.1
command ok
1 rows affected
1 rows affected
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5180
msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
sql_state: "HY000"
}
1 rows affected
command ok
1 rows affected
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5180
msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
sql_state: "HY000"
}
1 rows affected
Rows matched: 1 Changed: 1 Warnings: 0
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5180
msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
sql_state: "HY000"
}
0 rows affected
#
# VI.2
command ok
1 rows affected
1 rows affected
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5180
msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
sql_state: "HY000"
}
1 rows affected
Rows matched: 1 Changed: 1 Warnings: 0
command ok
Table Create Table
test_coll CREATE TABLE `test_coll` (
`doc` json DEFAULT NULL,
`_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
`_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object","properties":{"latitude":{"type":"number","maximum":50}},"required":["latitude"]}') VIRTUAL,
PRIMARY KEY (`_id`),
CONSTRAINT `$val_strict_889D1D09A01D7029B101675FBE738D1897A37F32` CHECK (json_schema_valid(`_json_schema`,`doc`))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
0 rows affected
1 rows affected
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5180
msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
sql_state: "HY000"
}
1 rows affected
Rows matched: 1 Changed: 1 Warnings: 0
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5180
msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
sql_state: "HY000"
}
0 rows affected
#
# VI.3
command ok
1 rows affected
1 rows affected
command ok
1 rows affected
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5180
msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
sql_state: "HY000"
}
0 rows affected
#
# VII
connecting...
active session is now 'temp'
command ok
Verify [Status variable "Mysqlx_stmt_modify_collection_options" needs to have a value of 0]
command ok
Verify [Status variable "Mysqlx_stmt_modify_collection_options" needs to have a value of 1]
Got expected error:
Mysqlx.Error {
severity: ERROR
code: 5017
msg: "Invalid \"validation.level\" argument. Allowed values are \'OFF\' and \'STRICT\'"
sql_state: "HY000"
}
Verify [Status variable "Mysqlx_stmt_modify_collection_options" needs to have a value of 2]
command ok
Verify [Status variable "Mysqlx_stmt_modify_collection_options" needs to have a value of 3]
0 rows affected
closing session temp
Mysqlx.Ok {
msg: "bye!"
}
switched to session default
Mysqlx.Ok {
msg: "bye!"
}
ok