Debian Codegraph @

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

raw
1 ## Test of general functionality of modify_collection_options admin command.
2
3 ## Preamble
4 --source include/xplugin_preamble.inc
5 --source include/xplugin_create_user.inc
6 ## Test starts here
7
8 --write_file $MYSQL_TMP_DIR/resultset.xpl
9 -->import assert_messages.macro
10 -->import assert_notices.macro
11 -->import validation_schema.macro
12
13 -->macro Create_base_collection
14 varlet %SCHEMA% type:SCALAR scalar{
15 type:V_STRING v_string{value:
16 "{\"type\": \"object\", \"properties\":
17 {\"latitude\": {\"type\": \"number\", \"minimum\": -90, \"maximum\": 90}},
18 \"required\": [\"latitude\"]}"}};
19 -->callmacro Execute_admin_cmd_with_validation create_collection test_coll %SCHEMA% "strict"
20 -->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk
21 -->callmacro Insert_value_to_collection test_coll '{"_id": "one", "latitude": 82}'
22 -->callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:1
23 -->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk
24 -->callmacro Insert_value_to_collection test_coll '{"_id": "two", "latitude": 49}'
25 -->callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:1
26 -->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk
27 -->endmacro
28
29 -->varlet %COMMAND% modify_collection_options
30
31 -->echo
32 -->echo
33 -->echo ## I. Check command flow when using a modify_collection_options admin
34 -->echo ## command.
35 -->echo #
36 -->echo # 1. Modify existing schema with other valid schema.
37 -->echo # 2. Modify existing schema with schema that does not match to existing
38 -->echo # collection content.
39
40 -->echo
41 -->echo #
42 -->echo # I.1
43 -->callmacro Create_base_collection
44 varlet %NEW_SCHEMA% type:SCALAR scalar{
45 type:V_STRING v_string{value:
46 "{\"type\": \"object\", \"properties\":
47 {\"latitude\": {\"type\": \"number\", \"minimum\": -90, \"maximum\": 100}},
48 \"required\": [\"latitude\"]}"}};
49 callmacro Execute_admin_cmd_with_validation %COMMAND%
50 test_coll
51 %NEW_SCHEMA%
52 "strict";
53 -->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk
54 -->callmacro Drop_collection test_coll
55
56 -->echo
57 -->echo #
58 -->echo # I.2
59 -->callmacro Create_base_collection
60 varlet %NEW_SCHEMA% type:SCALAR scalar{
61 type:V_STRING v_string{value:
62 "{\"type\": \"object\", \"properties\":
63 {\"latitude\": {\"type\": \"number\", \"minimum\": -90, \"maximum\": 50}},
64 \"required\": [\"latitude\"]}"}};
65 callmacro Execute_admin_cmd_with_validation %COMMAND%
66 test_coll
67 %NEW_SCHEMA%
68 "strict";
69 -->callmacro Assert_message Mysqlx.Error
70 -->callmacro Drop_collection test_coll
71
72 EOF
73
74
75 CREATE SCHEMA IF NOT EXISTS xtest;
76 USE xtest;
77
78 exec $MYSQLXTEST
79 -ux_root --password=''
80 --schema=xtest
81 --file=$MYSQL_TMP_DIR/resultset.xpl 2>&1;
82
83 ## Cleanup
84 --source ../include/xplugin_cleanup.inc