| 1 |
## Following macros are defined in this file: |
| 2 |
# |
| 3 |
# * Setup_testcase |
| 4 |
# * Setup_collection_with_data |
| 5 |
# * Find_execute_and_expect_error |
| 6 |
# * Update_execute_and_expect_error |
| 7 |
# * Delete_execute_and_expect_error |
| 8 |
# * Find_execute_and_expect |
| 9 |
# * Update_execute_and_expect |
| 10 |
# * Delete_execute_and_expect |
| 11 |
# |
| 12 |
|
| 13 |
|
| 14 |
-->macro Setup_testcase |
| 15 |
varlet %ANY_START% ; |
| 16 |
varlet %ANY_END% ; |
| 17 |
-->endmacro |
| 18 |
|
| 19 |
|
| 20 |
-->macro Setup_collection_with_data |
| 21 |
echo; |
| 22 |
echo [Setup table coll]; |
| 23 |
quiet; |
| 24 |
noquery_result; |
| 25 |
DROP TABLE IF EXISTS coll; |
| 26 |
stmtadmin ensure_collection {"name":"coll"}; |
| 27 |
recvresult be-quiet; |
| 28 |
|
| 29 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":0, "group3": "test", "group2": 5}'; |
| 30 |
recvresult be-quiet; |
| 31 |
|
| 32 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":1, "group3": "test", "group2": 5}'; |
| 33 |
recvresult be-quiet; |
| 34 |
|
| 35 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":2, "group3": "test", "group2": 4}'; |
| 36 |
recvresult be-quiet; |
| 37 |
|
| 38 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":3, "group3": "dev", "group2": 4}'; |
| 39 |
recvresult be-quiet; |
| 40 |
|
| 41 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":4, "group3": "dev", "group2": 3}'; |
| 42 |
recvresult be-quiet; |
| 43 |
|
| 44 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":5, "group3": "dev", "group2": 3}'; |
| 45 |
recvresult be-quiet; |
| 46 |
|
| 47 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":6, "group3": "prod", "group2": 2}'; |
| 48 |
recvresult be-quiet; |
| 49 |
|
| 50 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":7, "group3": "prod", "group2": 2}'; |
| 51 |
recvresult be-quiet; |
| 52 |
|
| 53 |
callmacro Crud_insert Collection1 'coll' Row_octet '{"myid":8, "group3": "prod", "group2": 1}'; |
| 54 |
recvresult be-quiet; |
| 55 |
|
| 56 |
noquiet; |
| 57 |
query_result; |
| 58 |
-->endmacro |
| 59 |
|
| 60 |
|
| 61 |
-->macro_varg Find_execute_and_expect_error %ERROR% %OPTIONS% |
| 62 |
echo [Assert Find operation returns an error, executed with %OPTIONS%]; |
| 63 |
quiet; |
| 64 |
Mysqlx.Crud.Find { |
| 65 |
collection { name: "coll" } |
| 66 |
data_model: DOCUMENT |
| 67 |
%OPTIONS% |
| 68 |
%VAR_ARGS% |
| 69 |
} |
| 70 |
expecterror %ERROR%; |
| 71 |
recvresult be-quiet; |
| 72 |
noquiet; |
| 73 |
-->endmacro |
| 74 |
|
| 75 |
|
| 76 |
-->macro_varg Delete_execute_and_expect_error %ERROR% %OPTIONS% |
| 77 |
echo [Assert Delete operation returns an error, executed with %OPTIONS%]; |
| 78 |
quiet; |
| 79 |
Mysqlx.Crud.Delete { |
| 80 |
collection { name: "coll" } |
| 81 |
data_model: DOCUMENT |
| 82 |
%OPTIONS% |
| 83 |
%VAR_ARGS% |
| 84 |
} |
| 85 |
expecterror %ERROR%; |
| 86 |
recvresult be-quiet; |
| 87 |
noquiet; |
| 88 |
-->endmacro |
| 89 |
|
| 90 |
|
| 91 |
-->macro_varg Update_execute_and_expect_error %ERROR% %OPTIONS% |
| 92 |
quiet; |
| 93 |
echo [Assert Update operation returns an error, executed with %OPTIONS%]; |
| 94 |
Mysqlx.Crud.Update { |
| 95 |
collection { name: "coll" } |
| 96 |
data_model: DOCUMENT |
| 97 |
|
| 98 |
operation { |
| 99 |
operation: ITEM_SET |
| 100 |
source{ |
| 101 |
document_path { |
| 102 |
type: MEMBER |
| 103 |
value: "group2" |
| 104 |
} |
| 105 |
} |
| 106 |
value { |
| 107 |
type: OPERATOR |
| 108 |
operator { |
| 109 |
name: "sign_minus" |
| 110 |
param { |
| 111 |
type: IDENT |
| 112 |
identifier { |
| 113 |
document_path{ |
| 114 |
type: MEMBER |
| 115 |
value: "group2" |
| 116 |
} |
| 117 |
} |
| 118 |
} |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
%OPTIONS% |
| 123 |
%VAR_ARGS% |
| 124 |
} |
| 125 |
expecterror %ERROR%; |
| 126 |
recvresult be-quiet; |
| 127 |
quiet; |
| 128 |
-->endmacro |
| 129 |
|
| 130 |
|
| 131 |
-->macro_varg Find_execute_and_expect %EXPECT_ROWS% %OPTIONS% |
| 132 |
echo [Assert Find operation and expect %EXPECT_ROWS% rows returned, executed with %OPTIONS%]; |
| 133 |
clear_received; |
| 134 |
quiet; |
| 135 |
Mysqlx.Crud.Find { |
| 136 |
collection { name: "coll" } |
| 137 |
data_model: DOCUMENT |
| 138 |
%OPTIONS% |
| 139 |
%VAR_ARGS% |
| 140 |
} |
| 141 |
recvresult be-quiet; |
| 142 |
received Mysqlx.Resultset.Row %RESULTSET_ROWS%; |
| 143 |
assert_eq %EXPECT_ROWS% %RESULTSET_ROWS%; |
| 144 |
noquiet; |
| 145 |
-->endmacro |
| 146 |
|
| 147 |
|
| 148 |
-->macro_varg Delete_execute_and_expect %EXPECT_ROWS% %OPTIONS% |
| 149 |
echo [Assert Delete operation and expect deletion of %EXPECT_ROWS% rows, executed with %OPTIONS%]; |
| 150 |
quiet; |
| 151 |
clear_received; |
| 152 |
Mysqlx.Crud.Delete { |
| 153 |
collection { name: "coll" } |
| 154 |
data_model: DOCUMENT |
| 155 |
|
| 156 |
%OPTIONS% |
| 157 |
%VAR_ARGS% |
| 158 |
} |
| 159 |
recvresult be-quiet; |
| 160 |
assert_eq %EXPECT_ROWS% %RESULT_ROWS_AFFECTED%; |
| 161 |
noquiet; |
| 162 |
-->endmacro |
| 163 |
|
| 164 |
|
| 165 |
-->macro_varg Update_execute_and_expect %EXPECT_ROWS% %OPTIONS% |
| 166 |
quiet; |
| 167 |
echo [Assert Update operation and expect rows modified %EXPECT_ROWS%, executed with %OPTIONS%]; |
| 168 |
clear_received; |
| 169 |
Mysqlx.Crud.Update { |
| 170 |
collection { name: "coll" } |
| 171 |
data_model: DOCUMENT |
| 172 |
|
| 173 |
operation { |
| 174 |
operation: ITEM_SET |
| 175 |
source{ |
| 176 |
document_path { |
| 177 |
type: MEMBER |
| 178 |
value: "group2" |
| 179 |
} |
| 180 |
} |
| 181 |
value { |
| 182 |
type: OPERATOR |
| 183 |
operator { |
| 184 |
name: "sign_minus" |
| 185 |
param { |
| 186 |
type: IDENT |
| 187 |
identifier { |
| 188 |
document_path{ |
| 189 |
type: MEMBER |
| 190 |
value: "group2" |
| 191 |
} |
| 192 |
} |
| 193 |
} |
| 194 |
} |
| 195 |
} |
| 196 |
} |
| 197 |
%OPTIONS% |
| 198 |
%VAR_ARGS% |
| 199 |
} |
| 200 |
recvresult be-quiet; |
| 201 |
assert_eq %EXPECT_ROWS% %RESULT_ROWS_AFFECTED%; |
| 202 |
quiet; |
| 203 |
-->endmacro |
| 204 |
|