]>
Commit | Line | Data |
---|---|---|
f85f8ebb BP |
1 | AT_BANNER([OVSDB -- execution]) |
2 | ||
39ab07af BP |
3 | m4_divert_push([PREPARE_TESTS]) |
4 | [ | |
5 | ||
6 | ordinal_schema () { | |
7 | cat <<'EOF' | |
8 | {"name": "ordinals", | |
f85f8ebb BP |
9 | "tables": { |
10 | "ordinals": { | |
11 | "columns": { | |
12 | "number": {"type": "integer"}, | |
6910a6e6 BP |
13 | "name": {"type": "string"}}, |
14 | "indexes": [["number"]]}}, | |
6aa09313 | 15 | "version": "5.1.3", |
39ab07af BP |
16 | "cksum": "12345678 9"} |
17 | EOF | |
18 | } | |
f85f8ebb | 19 | |
39ab07af BP |
20 | constraint_schema () { |
21 | cat << 'EOF' | |
22 | {"name": "constraints", | |
bd76d25d | 23 | "tables": { |
0d0f05b9 BP |
24 | "a": { |
25 | "columns": { | |
26 | "a": {"type": "integer"}, | |
27 | "a2a": {"type": {"key": {"type": "uuid", "refTable": "a"}, | |
28 | "min": 0, "max": "unlimited"}}, | |
29 | "a2b": {"type": {"key": {"type": "uuid", "refTable": "b"}, | |
30 | "min": 0, "max": "unlimited"}}}}, | |
31 | "b": { | |
32 | "columns": { | |
33 | "b": {"type": "integer"}, | |
34 | "b2a": {"type": {"key": {"type": "uuid", "refTable": "a"}, | |
35 | "min": 0, "max": "unlimited"}}, | |
36 | "b2b": {"type": {"key": {"type": "uuid", "refTable": "b"}, | |
b7585d1d BP |
37 | "min": 0, "max": "unlimited"}}, |
38 | "x": {"type": {"key": "integer", "min": 1, "max": 2}}}}, | |
bd76d25d BP |
39 | "constrained": { |
40 | "columns": { | |
41 | "positive": {"type": {"key": {"type": "integer", | |
87ab878c | 42 | "minInteger": 1}}}}, |
39ab07af BP |
43 | "maxRows": 1}}} |
44 | EOF | |
45 | } | |
bd76d25d | 46 | |
39ab07af BP |
47 | weak_schema () { |
48 | cat <<'EOF' | |
49 | {"name": "weak", | |
7360012b BP |
50 | "tables": { |
51 | "a": { | |
52 | "columns": { | |
53 | "a": {"type": "integer"}, | |
54 | "a2a": {"type": {"key": {"type": "uuid", | |
55 | "refTable": "a", | |
56 | "refType": "weak"}, | |
57 | "min": 0, "max": "unlimited"}}, | |
58 | "a2a1": {"type": {"key": {"type": "uuid", | |
59 | "refTable": "a", | |
60 | "refType": "weak"}}}, | |
61 | "a2b": {"type": {"key": {"type": "uuid", | |
62 | "refTable": "b", | |
63 | "refType": "weak"}}}}}, | |
64 | "b": { | |
65 | "columns": { | |
66 | "b": {"type": "integer"}, | |
67 | "b2a": {"type": {"key": {"type": "uuid", | |
68 | "refTable": "a", | |
69 | "refType": "weak"}, | |
39ab07af BP |
70 | "min": 0, "max": "unlimited"}}}}}} |
71 | EOF | |
72 | } | |
7360012b | 73 | |
39ab07af BP |
74 | gc_schema () { |
75 | cat <<'EOF' | |
76 | {"name": "gc", | |
c5f341ab BP |
77 | "tables": { |
78 | "root": { | |
79 | "columns": { | |
80 | "a": {"type": {"key": {"type": "uuid", | |
81 | "refTable": "a"}, | |
82 | "min": 0, "max": "unlimited"}}}, | |
83 | "isRoot": true}, | |
84 | "a": { | |
85 | "columns": { | |
86 | "a": {"type": "integer"}, | |
87 | "a2a": {"type": {"key": {"type": "uuid", | |
88 | "refTable": "a"}, | |
89 | "min": 0, "max": "unlimited"}}, | |
90 | "a2b": {"type": {"key": {"type": "uuid", | |
91 | "refTable": "b"}, | |
92 | "min": 0, "max": "unlimited"}}, | |
93 | "wa2a": {"type": {"key": {"type": "uuid", | |
94 | "refTable": "a", | |
95 | "refType": "weak"}, | |
96 | "min": 0, "max": "unlimited"}}, | |
97 | "wa2b": {"type": {"key": {"type": "uuid", | |
98 | "refTable": "b", | |
99 | "refType": "weak"}, | |
100 | "min": 0, "max": "unlimited"}}}}, | |
101 | "b": { | |
102 | "columns": { | |
103 | "b": {"type": "integer"}, | |
104 | "b2a": {"type": {"key": {"type": "uuid", | |
105 | "refTable": "a"}, | |
106 | "min": 0, "max": "unlimited"}}, | |
107 | "wb2a": {"type": {"key": {"type": "uuid", | |
108 | "refTable": "a", | |
109 | "refType": "weak"}, | |
110 | "min": 0, "max": "unlimited"}}}, | |
39ab07af BP |
111 | "isRoot": false}}} |
112 | EOF | |
113 | } | |
341c4e59 BP |
114 | |
115 | immutable_schema () { | |
116 | cat <<'EOF' | |
117 | {"name": "immutable", | |
118 | "tables": { | |
119 | "a": { | |
120 | "columns": {"i": {"type": "integer", "mutable": false}}}}} | |
121 | EOF | |
122 | } | |
39ab07af BP |
123 | ] |
124 | m4_divert_pop([PREPARE_TESTS]) | |
c5f341ab | 125 | |
21ff1aee BP |
126 | # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS]) |
127 | # | |
128 | # Runs "test-ovsdb execute" with the given SCHEMA and each of the | |
129 | # TRANSACTIONS (which should be a quoted list of quoted strings). | |
130 | # | |
131 | # Checks that the overall output is OUTPUT, but UUIDs in the output | |
f85f8ebb BP |
132 | # are replaced by markers of the form <N> where N is a number. The |
133 | # first unique UUID is replaced by <0>, the next by <1>, and so on. | |
134 | # If a given UUID appears more than once it is always replaced by the | |
135 | # same marker. | |
21ff1aee BP |
136 | # |
137 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
39ab07af | 138 | m4_define([OVSDB_CHECK_EXECUTION], |
f85f8ebb | 139 | [AT_SETUP([$1]) |
21ff1aee | 140 | AT_KEYWORDS([ovsdb execute execution positive $5]) |
2c487bc8 | 141 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR |
39ab07af | 142 | AT_CHECK([test-ovsdb execute "`$2`" m4_foreach([txn], [$3], [ 'txn'])], |
21ff1aee | 143 | [0], [stdout], []) |
5c6d0628 | 144 | AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [$4]) |
f85f8ebb BP |
145 | AT_CLEANUP]) |
146 | ||
d198c4be | 147 | OVSDB_CHECK_EXECUTION([uuid-name must be <id>], |
39ab07af | 148 | [constraint_schema], |
d198c4be BP |
149 | [[[["constraints", |
150 | {"op": "insert", | |
151 | "table": "a", | |
152 | "row": {}, | |
153 | "uuid-name": "0"}]]]], | |
154 | [[[{"details":"Parsing ovsdb operation 1 of 1 failed: Type mismatch for member 'uuid-name'.","error":"syntax error","syntax":"{\"op\":\"insert\",\"row\":{},\"table\":\"a\",\"uuid-name\":\"0\"}"}] | |
155 | ]]) | |
156 | ||
157 | OVSDB_CHECK_EXECUTION([named-uuid must be <id>], | |
39ab07af | 158 | [constraint_schema], |
d198c4be BP |
159 | [[[["constraints", |
160 | {"op": "insert", | |
161 | "table": "a", | |
162 | "row": {"a2a": ["named-uuid", "0"]}}]]]], | |
163 | [[[{"details":"named-uuid string is not a valid <id>","error":"syntax error","syntax":"[\"named-uuid\",\"0\"]"}] | |
164 | ]]) | |
165 | ||
19b48a81 | 166 | OVSDB_CHECK_EXECUTION([duplicate uuid-name not allowed], |
39ab07af | 167 | [ordinal_schema], |
19b48a81 BP |
168 | [[[["ordinals", |
169 | {"op": "insert", | |
170 | "table": "ordinals", | |
171 | "row": {}, | |
172 | "uuid-name": "x"}, | |
173 | {"op": "insert", | |
174 | "table": "ordinals", | |
175 | "row": {}, | |
176 | "uuid-name": "x"}]]]], | |
177 | [[[{"uuid":["uuid","<0>"]},{"details":"This \"uuid-name\" appeared on an earlier \"insert\" operation.","error":"duplicate uuid-name","syntax":"\"x\""}] | |
178 | ]]) | |
179 | ||
21ff1aee | 180 | m4_define([EXECUTION_EXAMPLES], [ |
88942565 BP |
181 | dnl At one point the "commit" code ignored new rows with all-default values, |
182 | dnl so this checks for that problem. | |
183 | OVSDB_CHECK_EXECUTION([insert default row, query table], | |
39ab07af | 184 | [ordinal_schema], |
88942565 BP |
185 | [[[["ordinals", |
186 | {"op": "insert", | |
187 | "table": "ordinals", | |
188 | "row": {}}]]], | |
189 | [[["ordinals", | |
190 | {"op": "select", | |
191 | "table": "ordinals", | |
192 | "where": []}]]]], | |
193 | [[[{"uuid":["uuid","<0>"]}] | |
194 | [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"","number":0}]}] | |
195 | ]]) | |
196 | ||
f85f8ebb | 197 | OVSDB_CHECK_EXECUTION([insert row, query table], |
39ab07af | 198 | [ordinal_schema], |
9cb53f26 BP |
199 | [[[["ordinals", |
200 | {"op": "insert", | |
f85f8ebb | 201 | "table": "ordinals", |
21ff1aee | 202 | "row": {"number": 0, "name": "zero"}}]]], |
9cb53f26 BP |
203 | [[["ordinals", |
204 | {"op": "select", | |
f85f8ebb | 205 | "table": "ordinals", |
21ff1aee | 206 | "where": []}]]]], |
f85f8ebb BP |
207 | [[[{"uuid":["uuid","<0>"]}] |
208 | [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]}] | |
209 | ]]) | |
210 | ||
211 | OVSDB_CHECK_EXECUTION([insert rows, query by value], | |
39ab07af | 212 | [ordinal_schema], |
9cb53f26 BP |
213 | [[[["ordinals", |
214 | {"op": "insert", | |
f85f8ebb | 215 | "table": "ordinals", |
21ff1aee | 216 | "row": {"number": 0, "name": "zero"}}]]], |
9cb53f26 BP |
217 | [[["ordinals", |
218 | {"op": "insert", | |
f85f8ebb | 219 | "table": "ordinals", |
21ff1aee | 220 | "row": {"number": 1, "name": "one"}}]]], |
9cb53f26 BP |
221 | [[["ordinals", |
222 | {"op": "select", | |
f85f8ebb | 223 | "table": "ordinals", |
21ff1aee | 224 | "where": [["name", "==", "zero"]]}]]], |
9cb53f26 BP |
225 | [[["ordinals", |
226 | {"op": "select", | |
f85f8ebb | 227 | "table": "ordinals", |
21ff1aee | 228 | "where": [["name", "==", "one"]]}]]]], |
f85f8ebb BP |
229 | [[[{"uuid":["uuid","<0>"]}] |
230 | [{"uuid":["uuid","<1>"]}] | |
231 | [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"zero","number":0}]}] | |
232 | [{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}] | |
233 | ]]) | |
234 | ||
235 | OVSDB_CHECK_EXECUTION([insert rows, query by named-uuid], | |
39ab07af | 236 | [ordinal_schema], |
9cb53f26 BP |
237 | [[[["ordinals", |
238 | {"op": "insert", | |
f85f8ebb BP |
239 | "table": "ordinals", |
240 | "row": {"number": 0, "name": "zero"}, | |
241 | "uuid-name": "first"}, | |
242 | {"op": "insert", | |
243 | "table": "ordinals", | |
244 | "row": {"number": 1, "name": "one"}, | |
245 | "uuid-name": "second"}, | |
246 | {"op": "select", | |
247 | "table": "ordinals", | |
248 | "where": [["_uuid", "==", ["named-uuid", "first"]]]}, | |
249 | {"op": "select", | |
250 | "table": "ordinals", | |
21ff1aee | 251 | "where": [["_uuid", "==", ["named-uuid", "second"]]]}]]]], |
f85f8ebb BP |
252 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"zero","number":0}]},{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}] |
253 | ]]) | |
254 | ||
255 | OVSDB_CHECK_EXECUTION([insert rows, update rows by value], | |
39ab07af | 256 | [ordinal_schema], |
9cb53f26 BP |
257 | [[[["ordinals", |
258 | {"op": "insert", | |
f85f8ebb BP |
259 | "table": "ordinals", |
260 | "row": {"number": 0, "name": "zero"}, | |
21ff1aee | 261 | "uuid-name": "first"}]]], |
9cb53f26 BP |
262 | [[["ordinals", |
263 | {"op": "insert", | |
f85f8ebb BP |
264 | "table": "ordinals", |
265 | "row": {"number": 1, "name": "one"}, | |
21ff1aee | 266 | "uuid-name": "first"}]]], |
9cb53f26 BP |
267 | [[["ordinals", |
268 | {"op": "update", | |
f85f8ebb BP |
269 | "table": "ordinals", |
270 | "where": [["name", "==", "zero"]], | |
21ff1aee | 271 | "row": {"name": "nought"}}]]], |
9cb53f26 BP |
272 | [[["ordinals", |
273 | {"op": "select", | |
f85f8ebb BP |
274 | "table": "ordinals", |
275 | "where": [], | |
21ff1aee | 276 | "sort": ["number"]}]]]], |
f85f8ebb BP |
277 | [[[{"uuid":["uuid","<0>"]}] |
278 | [{"uuid":["uuid","<1>"]}] | |
279 | [{"count":1}] | |
280 | [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"nought","number":0},{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}] | |
281 | ]]) | |
282 | ||
e9f8f936 | 283 | OVSDB_CHECK_EXECUTION([insert rows, mutate rows], |
39ab07af | 284 | [ordinal_schema], |
9cb53f26 BP |
285 | [[[["ordinals", |
286 | {"op": "insert", | |
e9f8f936 BP |
287 | "table": "ordinals", |
288 | "row": {"number": 0, "name": "zero"}, | |
289 | "uuid-name": "first"}]]], | |
9cb53f26 BP |
290 | [[["ordinals", |
291 | {"op": "insert", | |
e9f8f936 BP |
292 | "table": "ordinals", |
293 | "row": {"number": 1, "name": "one"}, | |
294 | "uuid-name": "first"}]]], | |
9cb53f26 BP |
295 | [[["ordinals", |
296 | {"op": "mutate", | |
e9f8f936 BP |
297 | "table": "ordinals", |
298 | "where": [["name", "==", "zero"]], | |
299 | "mutations": [["number", "+=", 2]]}]]], | |
9cb53f26 BP |
300 | [[["ordinals", |
301 | {"op": "select", | |
e9f8f936 BP |
302 | "table": "ordinals", |
303 | "where": [], | |
304 | "sort": ["number"]}]]]], | |
305 | [[[{"uuid":["uuid","<0>"]}] | |
306 | [{"uuid":["uuid","<1>"]}] | |
307 | [{"count":1}] | |
308 | [{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<2>"],"name":"one","number":1},{"_uuid":["uuid","<0>"],"_version":["uuid","<3>"],"name":"zero","number":2}]}] | |
309 | ]]) | |
310 | ||
f85f8ebb | 311 | OVSDB_CHECK_EXECUTION([insert rows, delete by named-uuid], |
39ab07af | 312 | [ordinal_schema], |
9cb53f26 BP |
313 | [[[["ordinals", |
314 | {"op": "insert", | |
f85f8ebb BP |
315 | "table": "ordinals", |
316 | "row": {"number": 0, "name": "zero"}, | |
317 | "uuid-name": "first"}, | |
318 | {"op": "insert", | |
319 | "table": "ordinals", | |
320 | "row": {"number": 1, "name": "one"}, | |
321 | "uuid-name": "second"}, | |
322 | {"op": "delete", | |
323 | "table": "ordinals", | |
324 | "where": [["_uuid", "==", ["named-uuid", "first"]]]}, | |
325 | {"op": "select", | |
326 | "table": "ordinals", | |
327 | "where": [], | |
21ff1aee | 328 | "columns": ["name","number"]}]]]], |
f85f8ebb BP |
329 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"count":1},{"rows":[{"name":"one","number":1}]}] |
330 | ]]) | |
331 | ||
332 | OVSDB_CHECK_EXECUTION([insert rows, delete rows by value], | |
39ab07af | 333 | [ordinal_schema], |
9cb53f26 BP |
334 | [[[["ordinals", |
335 | {"op": "insert", | |
f85f8ebb BP |
336 | "table": "ordinals", |
337 | "row": {"number": 0, "name": "zero"}, | |
21ff1aee | 338 | "uuid-name": "first"}]]], |
9cb53f26 BP |
339 | [[["ordinals", |
340 | {"op": "insert", | |
f85f8ebb BP |
341 | "table": "ordinals", |
342 | "row": {"number": 1, "name": "one"}, | |
21ff1aee | 343 | "uuid-name": "first"}]]], |
9cb53f26 BP |
344 | [[["ordinals", |
345 | {"op": "delete", | |
f85f8ebb | 346 | "table": "ordinals", |
21ff1aee | 347 | "where": [["name", "==", "zero"]]}]]], |
9cb53f26 BP |
348 | [[["ordinals", |
349 | {"op": "select", | |
f85f8ebb | 350 | "table": "ordinals", |
21ff1aee | 351 | "where": []}]]]], |
f85f8ebb BP |
352 | [[[{"uuid":["uuid","<0>"]}] |
353 | [{"uuid":["uuid","<1>"]}] | |
354 | [{"count":1}] | |
355 | [{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<2>"],"name":"one","number":1}]}] | |
356 | ]]) | |
357 | ||
358 | OVSDB_CHECK_EXECUTION([insert rows, delete by (non-matching) value], | |
39ab07af | 359 | [ordinal_schema], |
9cb53f26 BP |
360 | [[[["ordinals", |
361 | {"op": "insert", | |
f85f8ebb BP |
362 | "table": "ordinals", |
363 | "row": {"number": 0, "name": "zero"}, | |
21ff1aee | 364 | "uuid-name": "first"}]]], |
9cb53f26 BP |
365 | [[["ordinals", |
366 | {"op": "insert", | |
f85f8ebb BP |
367 | "table": "ordinals", |
368 | "row": {"number": 1, "name": "one"}, | |
21ff1aee | 369 | "uuid-name": "first"}]]], |
9cb53f26 BP |
370 | [[["ordinals", |
371 | {"op": "delete", | |
f85f8ebb | 372 | "table": "ordinals", |
21ff1aee | 373 | "where": [["name", "==", "nought"]]}]]], |
9cb53f26 BP |
374 | [[["ordinals", |
375 | {"op": "select", | |
f85f8ebb BP |
376 | "table": "ordinals", |
377 | "where": [], | |
21ff1aee | 378 | "sort": ["number"]}]]]], |
f85f8ebb BP |
379 | [[[{"uuid":["uuid","<0>"]}] |
380 | [{"uuid":["uuid","<1>"]}] | |
381 | [{"count":0}] | |
382 | [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"zero","number":0},{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}] | |
383 | ]]) | |
384 | ||
385 | OVSDB_CHECK_EXECUTION([insert rows, delete all], | |
39ab07af | 386 | [ordinal_schema], |
9cb53f26 BP |
387 | [[[["ordinals", |
388 | {"op": "insert", | |
f85f8ebb BP |
389 | "table": "ordinals", |
390 | "row": {"number": 0, "name": "zero"}, | |
391 | "uuid-name": "first"}, | |
392 | {"op": "insert", | |
393 | "table": "ordinals", | |
394 | "row": {"number": 1, "name": "one"}, | |
395 | "uuid-name": "second"}, | |
396 | {"op": "delete", | |
397 | "table": "ordinals", | |
398 | "where": []}, | |
399 | {"op": "select", | |
400 | "table": "ordinals", | |
401 | "where": [], | |
21ff1aee | 402 | "columns": ["name","number"]}]]]], |
f85f8ebb BP |
403 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"count":2},{"rows":[]}] |
404 | ]]) | |
405 | ||
406 | OVSDB_CHECK_EXECUTION([insert row, query table, commit], | |
39ab07af | 407 | [ordinal_schema], |
9cb53f26 BP |
408 | [[[["ordinals", |
409 | {"op": "insert", | |
f85f8ebb BP |
410 | "table": "ordinals", |
411 | "row": {"number": 0, "name": "zero"}}, | |
412 | {"op": "select", | |
413 | "table": "ordinals", | |
414 | "where": []}, | |
415 | {"op": "commit", | |
21ff1aee | 416 | "durable": false}]]]], |
f85f8ebb BP |
417 | [[[{"uuid":["uuid","<0>"]},{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]},{}] |
418 | ]]) | |
419 | ||
420 | OVSDB_CHECK_EXECUTION([insert row, query table, commit durably], | |
39ab07af | 421 | [ordinal_schema], |
9cb53f26 BP |
422 | [[[["ordinals", |
423 | {"op": "insert", | |
f85f8ebb BP |
424 | "table": "ordinals", |
425 | "row": {"number": 0, "name": "zero"}}, | |
426 | {"op": "select", | |
427 | "table": "ordinals", | |
428 | "where": []}, | |
429 | {"op": "commit", | |
21ff1aee | 430 | "durable": true}]]]], |
f85f8ebb BP |
431 | [[[{"uuid":["uuid","<0>"]},{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]},{}] |
432 | ]]) | |
433 | ||
434 | OVSDB_CHECK_EXECUTION([equality wait with correct rows], | |
39ab07af | 435 | [ordinal_schema], |
9cb53f26 BP |
436 | [[[["ordinals", |
437 | {"op": "insert", | |
f85f8ebb BP |
438 | "table": "ordinals", |
439 | "row": {"number": 0, "name": "zero"}}, | |
440 | {"op": "insert", | |
441 | "table": "ordinals", | |
442 | "row": {"number": 1, "name": "one"}}, | |
443 | {"op": "wait", | |
444 | "timeout": 0, | |
445 | "table": "ordinals", | |
446 | "where": [], | |
447 | "columns": ["name", "number"], | |
448 | "until": "==", | |
449 | "rows": [{"name": "zero", "number": 0}, | |
21ff1aee | 450 | {"name": "one", "number": 1}]}]]]], |
f85f8ebb BP |
451 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}] |
452 | ]]) | |
453 | ||
454 | OVSDB_CHECK_EXECUTION([equality wait with extra row], | |
39ab07af | 455 | [ordinal_schema], |
9cb53f26 BP |
456 | [[[["ordinals", |
457 | {"op": "insert", | |
f85f8ebb BP |
458 | "table": "ordinals", |
459 | "row": {"number": 0, "name": "zero"}}, | |
460 | {"op": "insert", | |
461 | "table": "ordinals", | |
462 | "row": {"number": 1, "name": "one"}}, | |
463 | {"op": "wait", | |
464 | "timeout": 0, | |
465 | "table": "ordinals", | |
466 | "where": [], | |
467 | "columns": ["name", "number"], | |
468 | "until": "==", | |
469 | "rows": [{"name": "zero", "number": 0}, | |
470 | {"name": "one", "number": 1}, | |
21ff1aee | 471 | {"name": "two", "number": 2}]}]]]], |
f85f8ebb BP |
472 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}] |
473 | ]]) | |
474 | ||
475 | OVSDB_CHECK_EXECUTION([equality wait with missing row], | |
39ab07af | 476 | [ordinal_schema], |
9cb53f26 BP |
477 | [[[["ordinals", |
478 | {"op": "insert", | |
f85f8ebb BP |
479 | "table": "ordinals", |
480 | "row": {"number": 0, "name": "zero"}}, | |
481 | {"op": "insert", | |
482 | "table": "ordinals", | |
483 | "row": {"number": 1, "name": "one"}}, | |
484 | {"op": "wait", | |
485 | "timeout": 0, | |
486 | "table": "ordinals", | |
487 | "where": [], | |
488 | "columns": ["name", "number"], | |
489 | "until": "==", | |
21ff1aee | 490 | "rows": [{"name": "one", "number": 1}]}]]]], |
f85f8ebb BP |
491 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}] |
492 | ]]) | |
493 | ||
494 | OVSDB_CHECK_EXECUTION([inequality wait with correct rows], | |
39ab07af | 495 | [ordinal_schema], |
9cb53f26 BP |
496 | [[[["ordinals", |
497 | {"op": "insert", | |
f85f8ebb BP |
498 | "table": "ordinals", |
499 | "row": {"number": 0, "name": "zero"}}, | |
500 | {"op": "insert", | |
501 | "table": "ordinals", | |
502 | "row": {"number": 1, "name": "one"}}, | |
503 | {"op": "wait", | |
504 | "timeout": 0, | |
505 | "table": "ordinals", | |
506 | "where": [], | |
507 | "columns": ["name", "number"], | |
508 | "until": "!=", | |
509 | "rows": [{"name": "zero", "number": 0}, | |
21ff1aee | 510 | {"name": "one", "number": 1}]}]]]], |
f85f8ebb BP |
511 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}] |
512 | ]]) | |
513 | ||
514 | OVSDB_CHECK_EXECUTION([inequality wait with extra row], | |
39ab07af | 515 | [ordinal_schema], |
9cb53f26 BP |
516 | [[[["ordinals", |
517 | {"op": "insert", | |
f85f8ebb BP |
518 | "table": "ordinals", |
519 | "row": {"number": 0, "name": "zero"}}, | |
520 | {"op": "insert", | |
521 | "table": "ordinals", | |
522 | "row": {"number": 1, "name": "one"}}, | |
523 | {"op": "wait", | |
524 | "timeout": 0, | |
525 | "table": "ordinals", | |
526 | "where": [], | |
527 | "columns": ["name", "number"], | |
528 | "until": "!=", | |
529 | "rows": [{"name": "zero", "number": 0}, | |
530 | {"name": "one", "number": 1}, | |
21ff1aee | 531 | {"name": "two", "number": 2}]}]]]], |
f85f8ebb BP |
532 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}] |
533 | ]]) | |
534 | ||
535 | OVSDB_CHECK_EXECUTION([inequality wait with missing row], | |
39ab07af | 536 | [ordinal_schema], |
9cb53f26 BP |
537 | [[[["ordinals", |
538 | {"op": "insert", | |
f85f8ebb BP |
539 | "table": "ordinals", |
540 | "row": {"number": 0, "name": "zero"}}, | |
541 | {"op": "insert", | |
542 | "table": "ordinals", | |
543 | "row": {"number": 1, "name": "one"}}, | |
544 | {"op": "wait", | |
545 | "timeout": 0, | |
546 | "table": "ordinals", | |
547 | "where": [], | |
548 | "columns": ["name", "number"], | |
549 | "until": "!=", | |
21ff1aee | 550 | "rows": [{"name": "one", "number": 1}]}]]]], |
f85f8ebb BP |
551 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}] |
552 | ]]) | |
bd76d25d BP |
553 | |
554 | OVSDB_CHECK_EXECUTION([insert and update constraints], | |
39ab07af | 555 | [constraint_schema], |
9cb53f26 BP |
556 | [[[["constraints", |
557 | {"op": "insert", | |
bd76d25d BP |
558 | "table": "constrained", |
559 | "row": {}}]]], | |
9cb53f26 BP |
560 | [[["constraints", |
561 | {"op": "insert", | |
bd76d25d BP |
562 | "table": "constrained", |
563 | "row": {"positive": -1}}]]], | |
9cb53f26 BP |
564 | [[["constraints", |
565 | {"op": "update", | |
bd76d25d BP |
566 | "table": "constrained", |
567 | "where": [], | |
87ab878c BP |
568 | "row": {"positive": -2}}]]], |
569 | [[["constraints", | |
570 | {"op": "insert", | |
571 | "table": "constrained", | |
572 | "row": {"positive": 1}}]]], | |
573 | [[["constraints", | |
574 | {"op": "insert", | |
575 | "table": "constrained", | |
576 | "row": {"positive": 2}}]]]], | |
bd76d25d BP |
577 | [[[{"details":"0 is less than minimum allowed value 1","error":"constraint violation"}] |
578 | [{"details":"-1 is less than minimum allowed value 1","error":"constraint violation"}] | |
579 | [{"details":"-2 is less than minimum allowed value 1","error":"constraint violation"}] | |
87ab878c BP |
580 | [{"uuid":["uuid","<0>"]}] |
581 | [{"uuid":["uuid","<1>"]},{"details":"transaction causes \"constrained\" table to contain 2 rows, greater than the schema-defined limit of 1 row(s)","error":"constraint violation"}] | |
0d0f05b9 BP |
582 | ]]) |
583 | ||
6910a6e6 | 584 | OVSDB_CHECK_EXECUTION([index uniqueness checking], |
39ab07af | 585 | [ordinal_schema], |
6910a6e6 BP |
586 | dnl Insert initial row. |
587 | [[[["ordinals", | |
588 | {"op": "insert", | |
589 | "table": "ordinals", | |
590 | "row": {"number": 1, "name": "one"}}]]], | |
591 | dnl Try to insert row with identical value (fails). | |
592 | [[["ordinals", | |
593 | {"op": "insert", | |
594 | "table": "ordinals", | |
595 | "row": {"number": 1, "name": "another one"}}]]], | |
596 | dnl Remove initial row and insert new row with identical value in a single | |
597 | dnl transaction (succeeds). | |
598 | [[["ordinals", | |
599 | {"op": "insert", | |
600 | "table": "ordinals", | |
601 | "row": {"number": 1, "name": "another one"}}, | |
602 | {"op": "delete", | |
603 | "table": "ordinals", | |
604 | "where": [["name", "==", "one"]]}]]], | |
605 | dnl Remove row and insert two new rows with identical value in a single | |
606 | dnl transaction (fails). | |
607 | [[["ordinals", | |
608 | {"op": "delete", | |
609 | "table": "ordinals", | |
610 | "where": []}, | |
611 | {"op": "insert", | |
612 | "table": "ordinals", | |
613 | "row": {"number": 1, "name": "one"}}, | |
614 | {"op": "insert", | |
615 | "table": "ordinals", | |
616 | "row": {"number": 1, "name": "still another one"}}]]], | |
617 | dnl Add new row with different value (succeeds). | |
618 | [[["ordinals", | |
619 | {"op": "insert", | |
620 | "table": "ordinals", | |
621 | "row": {"number": 2, "name": "two"}}]]], | |
622 | dnl Change rows so values collide (fails). | |
623 | [[["ordinals", | |
624 | {"op": "update", | |
625 | "table": "ordinals", | |
626 | "where": [], | |
627 | "row": {"number": 3}}]]], | |
628 | dnl Swap rows' values (succeeds). | |
629 | [[["ordinals", | |
630 | {"op": "update", | |
631 | "table": "ordinals", | |
632 | "where": [["number", "==", 1]], | |
633 | "row": {"number": 2, "name": "old two"}}, | |
634 | {"op": "update", | |
635 | "table": "ordinals", | |
636 | "where": [["name", "==", "two"]], | |
637 | "row": {"number": 1, "name": "old one"}}]]], | |
638 | dnl Change all rows' values to values not used before and insert values that | |
639 | dnl collide (only) with their previous values (succeeds). | |
640 | [[["ordinals", | |
641 | {"op": "mutate", | |
642 | "table": "ordinals", | |
643 | "where": [], | |
644 | "mutations": [["number", "*=", 10]]}, | |
645 | {"op": "insert", | |
646 | "table": "ordinals", | |
647 | "row": {"number": 1, "name": "new one"}}, | |
648 | {"op": "insert", | |
649 | "table": "ordinals", | |
650 | "row": {"number": 2, "name": "new two"}}, | |
651 | {"op": "select", | |
652 | "table": "ordinals", | |
653 | "where": [], | |
654 | "columns": ["number", "name"], | |
655 | "sort": ["number"]}]]]], | |
656 | [[[{"uuid":["uuid","<0>"]}] | |
657 | [{"uuid":["uuid","<1>"]},{"details":"Transaction causes multiple rows in \"ordinals\" table to have identical values (1) for index on column \"number\". First row, with UUID <0>, existed in the database before this transaction and was not modified by the transaction. Second row, with UUID <1>, was inserted by this transaction.","error":"constraint violation"}] | |
658 | [{"uuid":["uuid","<2>"]},{"count":1}] | |
659 | [{"count":1},{"uuid":["uuid","<3>"]},{"uuid":["uuid","<4>"]},{"details":"Transaction causes multiple rows in \"ordinals\" table to have identical values (1) for index on column \"number\". First row, with UUID <4>, was inserted by this transaction. Second row, with UUID <3>, was inserted by this transaction.","error":"constraint violation"}] | |
660 | [{"uuid":["uuid","<5>"]}] | |
661 | [{"count":2},{"details":"Transaction causes multiple rows in \"ordinals\" table to have identical values (3) for index on column \"number\". First row, with UUID <5>, had the following index values before the transaction: 2. Second row, with UUID <2>, had the following index values before the transaction: 1.","error":"constraint violation"}] | |
662 | [{"count":1},{"count":1}] | |
663 | [{"count":2},{"uuid":["uuid","<6>"]},{"uuid":["uuid","<7>"]},{"rows":[{"name":"new one","number":1},{"name":"new two","number":2},{"name":"old one","number":10},{"name":"old two","number":20}]}] | |
664 | ]]) | |
665 | ||
0d0f05b9 | 666 | OVSDB_CHECK_EXECUTION([referential integrity -- simple], |
39ab07af | 667 | [constraint_schema], |
9cb53f26 BP |
668 | [[[["constraints", |
669 | {"op": "insert", | |
0d0f05b9 BP |
670 | "table": "b", |
671 | "row": {"b": 1}, | |
672 | "uuid-name": "brow"}, | |
673 | {"op": "insert", | |
674 | "table": "a", | |
675 | "row": {"a": 0, | |
676 | "a2b": ["set", [["named-uuid", "brow"]]]}}, | |
677 | {"op": "insert", | |
678 | "table": "a", | |
679 | "row": {"a": 1, | |
680 | "a2b": ["set", [["named-uuid", "brow"]]]}}, | |
681 | {"op": "insert", | |
682 | "table": "a", | |
683 | "row": {"a": 2, | |
684 | "a2b": ["set", [["named-uuid", "brow"]]]}}]]], | |
9cb53f26 BP |
685 | [[["constraints", |
686 | {"op": "delete", | |
0d0f05b9 BP |
687 | "table": "b", |
688 | "where": []}]]], | |
b7585d1d BP |
689 | dnl Check that "mutate" honors number-of-elements constraints on sets and maps. |
690 | [[["constraints", | |
691 | {"op": "mutate", | |
692 | "table": "b", | |
693 | "where": [], | |
694 | "mutations": [["x", "delete", 0]]}]]], | |
9cb53f26 BP |
695 | [[["constraints", |
696 | {"op": "delete", | |
0d0f05b9 BP |
697 | "table": "a", |
698 | "where": [["a", "==", 0]]}]]], | |
9cb53f26 BP |
699 | [[["constraints", |
700 | {"op": "delete", | |
0d0f05b9 BP |
701 | "table": "b", |
702 | "where": []}]]], | |
9cb53f26 BP |
703 | [[["constraints", |
704 | {"op": "delete", | |
0d0f05b9 BP |
705 | "table": "a", |
706 | "where": [["a", "==", 1]]}]]], | |
9cb53f26 BP |
707 | [[["constraints", |
708 | {"op": "delete", | |
0d0f05b9 BP |
709 | "table": "b", |
710 | "where": []}]]], | |
9cb53f26 BP |
711 | [[["constraints", |
712 | {"op": "delete", | |
0d0f05b9 BP |
713 | "table": "a", |
714 | "where": [["a", "==", 2]]}]]], | |
9cb53f26 BP |
715 | [[["constraints", |
716 | {"op": "delete", | |
0d0f05b9 BP |
717 | "table": "b", |
718 | "where": []}]]]], | |
719 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}] | |
720 | [{"count":1},{"details":"cannot delete b row <0> because of 3 remaining reference(s)","error":"referential integrity violation"}] | |
b7585d1d | 721 | [{"details":"Attempted to store 0 elements in set of 1 to 2 integers.","error":"constraint violation"}] |
0d0f05b9 BP |
722 | [{"count":1}] |
723 | [{"count":1},{"details":"cannot delete b row <0> because of 2 remaining reference(s)","error":"referential integrity violation"}] | |
724 | [{"count":1}] | |
725 | [{"count":1},{"details":"cannot delete b row <0> because of 1 remaining reference(s)","error":"referential integrity violation"}] | |
726 | [{"count":1}] | |
727 | [{"count":1}] | |
728 | ]]) | |
729 | ||
730 | OVSDB_CHECK_EXECUTION([referential integrity -- mutual references], | |
39ab07af | 731 | [constraint_schema], |
9cb53f26 BP |
732 | [[[["constraints", |
733 | {"op": "insert", | |
0d0f05b9 BP |
734 | "table": "a", |
735 | "row": {"a": 0, | |
736 | "a2b": ["set", [["named-uuid", "row2"]]], | |
737 | "a2a": ["set", [["named-uuid", "row1"]]]}, | |
738 | "uuid-name": "row1"}, | |
739 | {"op": "insert", | |
740 | "table": "b", | |
741 | "row": {"b": 1, | |
742 | "b2b": ["set", [["named-uuid", "row2"]]], | |
743 | "b2a": ["set", [["named-uuid", "row1"]]]}, | |
744 | "uuid-name": "row2"}]]], | |
9cb53f26 BP |
745 | [[["constraints", |
746 | {"op": "insert", | |
0d0f05b9 BP |
747 | "table": "a", |
748 | "row": {"a2b": ["set", [["uuid", "b516b960-5b19-4fc2-bb82-fe1cbd6d0241"]]]}}]]], | |
9cb53f26 BP |
749 | [[["constraints", |
750 | {"op": "delete", | |
0d0f05b9 BP |
751 | "table": "a", |
752 | "where": [["a", "==", 0]]}]]], | |
9cb53f26 BP |
753 | [[["constraints", |
754 | {"op": "delete", | |
0d0f05b9 BP |
755 | "table": "b", |
756 | "where": [["b", "==", 1]]}]]], | |
757 | dnl Try the deletions again to make sure that the refcounts got rolled back. | |
9cb53f26 BP |
758 | [[["constraints", |
759 | {"op": "delete", | |
0d0f05b9 BP |
760 | "table": "a", |
761 | "where": [["a", "==", 0]]}]]], | |
9cb53f26 BP |
762 | [[["constraints", |
763 | {"op": "delete", | |
0d0f05b9 BP |
764 | "table": "b", |
765 | "where": [["b", "==", 1]]}]]], | |
9cb53f26 BP |
766 | [[["constraints", |
767 | {"op": "delete", | |
0d0f05b9 BP |
768 | "table": "a", |
769 | "where": [["a", "==", 0]]}, | |
770 | {"op": "delete", | |
771 | "table": "b", | |
772 | "where": [["b", "==", 1]]}]]]], | |
fbf925e4 | 773 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}] |
97f7803b | 774 | [{"uuid":["uuid","<2>"]},{"details":"Table a column a2b row <2> references nonexistent row <3> in table b.","error":"referential integrity violation"}] |
0d0f05b9 BP |
775 | [{"count":1},{"details":"cannot delete a row <0> because of 1 remaining reference(s)","error":"referential integrity violation"}] |
776 | [{"count":1},{"details":"cannot delete b row <1> because of 1 remaining reference(s)","error":"referential integrity violation"}] | |
777 | [{"count":1},{"details":"cannot delete a row <0> because of 1 remaining reference(s)","error":"referential integrity violation"}] | |
778 | [{"count":1},{"details":"cannot delete b row <1> because of 1 remaining reference(s)","error":"referential integrity violation"}] | |
779 | [{"count":1},{"count":1}] | |
7360012b BP |
780 | ]]) |
781 | ||
782 | OVSDB_CHECK_EXECUTION([weak references], | |
39ab07af | 783 | [weak_schema], |
7360012b BP |
784 | [[[["weak", |
785 | {"op": "insert", | |
786 | "table": "a", | |
787 | "row": {"a": 0, | |
788 | "a2a": ["set", [["named-uuid", "row1"], | |
789 | ["named-uuid", "row2"], | |
790 | ["uuid", "0e767b36-6822-4044-8307-d58467e04669"]]], | |
791 | "a2a1": ["named-uuid", "row1"], | |
792 | "a2b": ["named-uuid", "row3"]}, | |
793 | "uuid-name": "row1"}, | |
794 | {"op": "insert", | |
795 | "table": "a", | |
796 | "row": {"a": 1, | |
797 | "a2a": ["set", [["named-uuid", "row1"], | |
798 | ["named-uuid", "row2"]]], | |
799 | "a2a1": ["named-uuid", "row2"], | |
800 | "a2b": ["named-uuid", "row3"]}, | |
801 | "uuid-name": "row2"}, | |
802 | {"op": "insert", | |
803 | "table": "a", | |
804 | "row": {"a": 2, | |
805 | "a2a": ["set", [["named-uuid", "row1"], | |
806 | ["named-uuid", "row2"]]], | |
807 | "a2a1": ["named-uuid", "row2"], | |
808 | "a2b": ["named-uuid", "row4"]}}, | |
809 | {"op": "insert", | |
810 | "table": "b", | |
811 | "row": {"b": 2, | |
812 | "b2a": ["named-uuid", "row1"]}, | |
813 | "uuid-name": "row3"}, | |
814 | {"op": "insert", | |
815 | "table": "b", | |
816 | "row": {"b": 3, | |
817 | "b2a": ["named-uuid", "row2"]}, | |
818 | "uuid-name": "row4"}]]], | |
819 | dnl Check that the nonexistent row UUID we added to row a0 was deleted, | |
820 | dnl and that other rows were inserted as requested. | |
821 | [[["weak", | |
822 | {"op": "select", | |
823 | "table": "a", | |
824 | "where": [], | |
825 | "columns": ["_uuid", "a2a", "a2a1", "a2b"], | |
826 | "sort": ["a"]}]]], | |
827 | [[["weak", | |
828 | {"op": "select", | |
829 | "table": "b", | |
830 | "where": [], | |
831 | "columns": ["_uuid", "b", "b2a"], | |
832 | "sort": ["b"]}]]], | |
833 | dnl Try to insert invalid all-zeros weak reference (the default) into | |
834 | dnl "a2b", which requires exactly one value. | |
835 | [[["weak", | |
836 | {"op": "insert", | |
837 | "table": "a", | |
1f4f3cd7 BP |
838 | "row": {"a2a1": ["named-uuid", "me"]}, |
839 | "uuid-name": "me"}]]], | |
7360012b BP |
840 | dnl Try to delete row from "b" that is referred to by weak references |
841 | dnl from "a" table "a2b" column that requires exactly one value. | |
842 | [[["weak", | |
843 | {"op": "delete", | |
844 | "table": "b", | |
845 | "where": [["b", "==", 3]]}]]], | |
846 | dnl Try to delete row from "a" that is referred to by weak references | |
847 | dnl from "a" table "a2a1" column that requires exactly one value. | |
848 | [[["weak", | |
849 | {"op": "delete", | |
850 | "table": "a", | |
851 | "where": [["a", "==", 1]]}]]], | |
852 | dnl Delete the row that had the reference that caused the previous | |
853 | dnl deletion to fail, then check that other rows are unchanged. | |
854 | [[["weak", | |
855 | {"op": "delete", | |
856 | "table": "a", | |
857 | "where": [["a", "==", 2]]}]]], | |
858 | [[["weak", | |
859 | {"op": "select", | |
860 | "table": "a", | |
861 | "where": [], | |
862 | "columns": ["_uuid", "a2a", "a2a1", "a2b"], | |
863 | "sort": ["a"]}]]], | |
864 | [[["weak", | |
865 | {"op": "select", | |
866 | "table": "b", | |
867 | "where": [], | |
868 | "columns": ["_uuid", "b", "b2a"], | |
869 | "sort": ["b"]}]]], | |
870 | dnl Delete row a0 then check that references to it were removed. | |
871 | [[["weak", | |
872 | {"op": "delete", | |
873 | "table": "a", | |
874 | "where": [["a", "==", 0]]}]]], | |
875 | [[["weak", | |
876 | {"op": "select", | |
877 | "table": "a", | |
878 | "where": [], | |
879 | "columns": ["_uuid", "a2a", "a2a1", "a2b"], | |
880 | "sort": ["a"]}]]], | |
881 | [[["weak", | |
882 | {"op": "select", | |
883 | "table": "b", | |
884 | "where": [], | |
885 | "columns": ["_uuid", "b", "b2a"], | |
886 | "sort": ["b"]}]]], | |
887 | dnl Delete row a1 then check that references to it were removed. | |
888 | [[["weak", | |
889 | {"op": "delete", | |
890 | "table": "a", | |
891 | "where": [["a", "==", 1]]}]]], | |
892 | [[["weak", | |
893 | {"op": "select", | |
894 | "table": "a", | |
895 | "where": [], | |
896 | "columns": ["_uuid", "a2a", "a2a1", "a2b"], | |
897 | "sort": ["a"]}]]], | |
898 | [[["weak", | |
899 | {"op": "select", | |
900 | "table": "b", | |
901 | "where": [], | |
902 | "columns": ["_uuid", "b", "b2a"], | |
903 | "sort": ["b"]}]]]], | |
904 | [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]},{"uuid":["uuid","<4>"]}] | |
905 | [{"rows":[{"_uuid":["uuid","<0>"],"a2a":["set",[["uuid","<0>"],["uuid","<1>"]]],"a2a1":["uuid","<0>"],"a2b":["uuid","<3>"]},{"_uuid":["uuid","<1>"],"a2a":["set",[["uuid","<0>"],["uuid","<1>"]]],"a2a1":["uuid","<1>"],"a2b":["uuid","<3>"]},{"_uuid":["uuid","<2>"],"a2a":["set",[["uuid","<0>"],["uuid","<1>"]]],"a2a1":["uuid","<1>"],"a2b":["uuid","<4>"]}]}] | |
906 | [{"rows":[{"_uuid":["uuid","<3>"],"b":2,"b2a":["uuid","<0>"]},{"_uuid":["uuid","<4>"],"b":3,"b2a":["uuid","<1>"]}]}] | |
907 | [{"uuid":["uuid","<5>"]},{"details":"Weak reference column \"a2b\" in \"a\" row <5> (inserted within this transaction) contained all-zeros UUID (probably as the default value for this column) but deleting this value caused a constraint volation because this column is not allowed to be empty.","error":"constraint violation"}] | |
908 | [{"count":1},{"details":"Deletion of 1 weak reference(s) to deleted (or never-existing) rows from column \"a2b\" in \"a\" row <2> caused this column to become empty, but constraints on this column disallow an empty column.","error":"constraint violation"}] | |
909 | [{"count":1},{"details":"Deletion of 1 weak reference(s) to deleted (or never-existing) rows from column \"a2a1\" in \"a\" row <2> caused this column to become empty, but constraints on this column disallow an empty column.","error":"constraint violation"}] | |
910 | [{"count":1}] | |
911 | [{"rows":[{"_uuid":["uuid","<0>"],"a2a":["set",[["uuid","<0>"],["uuid","<1>"]]],"a2a1":["uuid","<0>"],"a2b":["uuid","<3>"]},{"_uuid":["uuid","<1>"],"a2a":["set",[["uuid","<0>"],["uuid","<1>"]]],"a2a1":["uuid","<1>"],"a2b":["uuid","<3>"]}]}] | |
912 | [{"rows":[{"_uuid":["uuid","<3>"],"b":2,"b2a":["uuid","<0>"]},{"_uuid":["uuid","<4>"],"b":3,"b2a":["uuid","<1>"]}]}] | |
913 | [{"count":1}] | |
914 | [{"rows":[{"_uuid":["uuid","<1>"],"a2a":["uuid","<1>"],"a2a1":["uuid","<1>"],"a2b":["uuid","<3>"]}]}] | |
915 | [{"rows":[{"_uuid":["uuid","<3>"],"b":2,"b2a":["set",[]]},{"_uuid":["uuid","<4>"],"b":3,"b2a":["uuid","<1>"]}]}] | |
916 | [{"count":1}] | |
917 | [{"rows":[]}] | |
918 | [{"rows":[{"_uuid":["uuid","<3>"],"b":2,"b2a":["set",[]]},{"_uuid":["uuid","<4>"],"b":3,"b2a":["set",[]]}]}] | |
c5f341ab BP |
919 | ]]) |
920 | ||
341c4e59 BP |
921 | OVSDB_CHECK_EXECUTION([immutable columns], |
922 | [immutable_schema], | |
923 | [[[["immutable", | |
924 | {"op": "insert", | |
925 | "table": "a", | |
926 | "row": {"i": 5}, | |
927 | "uuid-name": "row1"}]]], | |
928 | [[["immutable", | |
929 | {"op": "update", | |
930 | "table": "a", | |
931 | "row": {"i": 10}, | |
932 | "where": []}]]], | |
933 | [[["immutable", | |
934 | {"op": "update", | |
935 | "table": "a", | |
936 | "row": {"i": 5}, | |
937 | "where": []}]]], | |
938 | [[["immutable", | |
939 | {"op": "mutate", | |
940 | "table": "a", | |
941 | "where": [], | |
942 | "mutations": [["i", "-=", 5]]}]]], | |
943 | [[["immutable", | |
944 | {"op": "mutate", | |
945 | "table": "a", | |
946 | "where": [], | |
947 | "mutations": [["i", "*=", 1]]}]]]], | |
948 | [[[{"uuid":["uuid","<0>"]}] | |
949 | [{"details":"Cannot update immutable column i in table a.","error":"constraint violation","syntax":"{\"op\":\"update\",\"row\":{\"i\":10},\"table\":\"a\",\"where\":[]}"}] | |
950 | [{"details":"Cannot update immutable column i in table a.","error":"constraint violation","syntax":"{\"op\":\"update\",\"row\":{\"i\":5},\"table\":\"a\",\"where\":[]}"}] | |
951 | [{"details":"Cannot mutate immutable column i in table a.","error":"constraint violation","syntax":"[\"i\",\"-=\",5]"}] | |
952 | [{"details":"Cannot mutate immutable column i in table a.","error":"constraint violation","syntax":"[\"i\",\"*=\",1]"}] | |
953 | ]]) | |
954 | ||
c5f341ab | 955 | OVSDB_CHECK_EXECUTION([garbage collection], |
39ab07af | 956 | [gc_schema], |
c5f341ab BP |
957 | [dnl Check that inserting a row without any references is a no-op. |
958 | [[["gc", | |
959 | {"op": "insert", | |
960 | "table": "a", | |
961 | "row": {"a": 0}}]]], | |
962 | [[["gc", | |
963 | {"op": "select", | |
964 | "table": "a", | |
965 | "where": [], | |
966 | "columns": ["a"]}]]], | |
967 | dnl Check that inserting a chain of rows that reference each other | |
968 | dnl in turn is also a no-op. | |
969 | [[["gc", | |
970 | {"op": "insert", | |
971 | "table": "a", | |
972 | "row": {"a": 0, "a2a": ["named-uuid", "row1"]}, | |
973 | "uuid-name": "row0"}, | |
974 | {"op": "insert", | |
975 | "table": "a", | |
976 | "row": {"a": 1, "a2a": ["named-uuid", "row2"]}, | |
977 | "uuid-name": "row1"}, | |
978 | {"op": "insert", | |
979 | "table": "a", | |
980 | "row": {"a": 2, "a2a": ["named-uuid", "row3"]}, | |
981 | "uuid-name": "row2"}, | |
982 | {"op": "insert", | |
983 | "table": "a", | |
984 | "row": {"a": 3}, | |
985 | "uuid-name": "row3"}]]], | |
986 | [[["gc", | |
987 | {"op": "select", | |
988 | "table": "a", | |
989 | "where": [], | |
990 | "columns": ["a"]}]]], | |
991 | dnl Check that inserting a pair of rows that mutually reference each | |
992 | dnl other causes the rows to be retained. | |
993 | [[["gc", | |
994 | {"op": "insert", | |
995 | "table": "a", | |
996 | "row": {"a": 4, "a2a": ["named-uuid", "row5"]}, | |
997 | "uuid-name": "row4"}, | |
998 | {"op": "insert", | |
999 | "table": "a", | |
1000 | "row": {"a": 5, "a2a": ["named-uuid", "row4"]}, | |
1001 | "uuid-name": "row5"}]]], | |
1002 | [[["gc", | |
1003 | {"op": "select", | |
1004 | "table": "a", | |
1005 | "where": [], | |
1006 | "columns": ["a"], | |
1007 | "sort": ["a"]}]]], | |
1008 | dnl Check that unreferencing one of the rows causes the other to be deleted. | |
1009 | [[["gc", | |
1010 | {"op": "update", | |
1011 | "table": "a", | |
1012 | "where": [["a", "==", 4]], | |
1013 | "row": {"a2a": ["set", []]}}]]], | |
1014 | [[["gc", | |
1015 | {"op": "select", | |
1016 | "table": "a", | |
1017 | "where": [], | |
1018 | "columns": ["a"]}]]], | |
1019 | dnl Check that inserting a pair of rows that mutually weak reference each | |
1020 | dnl other is a no-op. | |
1021 | [[["gc", | |
1022 | {"op": "insert", | |
1023 | "table": "a", | |
1024 | "row": {"a": 6, "wa2a": ["named-uuid", "row7"]}, | |
1025 | "uuid-name": "row6"}, | |
1026 | {"op": "insert", | |
1027 | "table": "a", | |
1028 | "row": {"a": 7, "wa2a": ["named-uuid", "row6"]}, | |
1029 | "uuid-name": "row7"}]]], | |
1030 | [[["gc", | |
1031 | {"op": "select", | |
1032 | "table": "a", | |
1033 | "where": [], | |
1034 | "columns": ["a"]}]]], | |
1035 | dnl Check that a circular chain of rows is retained. | |
1036 | [[["gc", | |
1037 | {"op": "insert", | |
1038 | "table": "a", | |
1039 | "row": {"a": 8, "a2a": ["named-uuid", "row9"]}, | |
1040 | "uuid-name": "row8"}, | |
1041 | {"op": "insert", | |
1042 | "table": "a", | |
1043 | "row": {"a": 9, "a2a": ["named-uuid", "row10"]}, | |
1044 | "uuid-name": "row9"}, | |
1045 | {"op": "insert", | |
1046 | "table": "a", | |
1047 | "row": {"a": 10, "a2a": ["named-uuid", "row11"]}, | |
1048 | "uuid-name": "row10"}, | |
1049 | {"op": "insert", | |
1050 | "table": "a", | |
1051 | "row": {"a": 11, "a2a": ["named-uuid", "row8"]}, | |
1052 | "uuid-name": "row11"}]]], | |
1053 | [[["gc", | |
1054 | {"op": "select", | |
1055 | "table": "a", | |
1056 | "where": [], | |
1057 | "columns": ["a"], | |
1058 | "sort": ["a"]}]]], | |
1059 | dnl Check that breaking the chain causes all of the rows to be deleted. | |
1060 | [[["gc", | |
1061 | {"op": "update", | |
1062 | "table": "a", | |
1063 | "where": [["a", "==", 9]], | |
1064 | "row": {"a2a": ["set", []]}}]]], | |
1065 | [[["gc", | |
1066 | {"op": "select", | |
1067 | "table": "a", | |
1068 | "where": [], | |
1069 | "columns": ["a"]}]]], | |
1070 | dnl Check that inserting a row only referenced by itself is a no-op. | |
1071 | [[["gc", | |
1072 | {"op": "insert", | |
1073 | "table": "a", | |
1074 | "row": {"a": 12, "a2a": ["named-uuid", "self"]}, | |
1075 | "uuid-name": "self"}]]], | |
1076 | [[["gc", | |
1077 | {"op": "select", | |
1078 | "table": "a", | |
1079 | "where": [], | |
1080 | "columns": ["a"]}]]]], | |
1081 | [[[{"uuid":["uuid","<0>"]}] | |
1082 | [{"rows":[]}] | |
1083 | [{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]},{"uuid":["uuid","<4>"]}] | |
1084 | [{"rows":[]}] | |
1085 | [{"uuid":["uuid","<5>"]},{"uuid":["uuid","<6>"]}] | |
1086 | [{"rows":[{"a":4},{"a":5}]}] | |
1087 | [{"count":1}] | |
1088 | [{"rows":[]}] | |
1089 | [{"uuid":["uuid","<7>"]},{"uuid":["uuid","<8>"]}] | |
1090 | [{"rows":[]}] | |
1091 | [{"uuid":["uuid","<9>"]},{"uuid":["uuid","<10>"]},{"uuid":["uuid","<11>"]},{"uuid":["uuid","<12>"]}] | |
1092 | [{"rows":[{"a":8},{"a":9},{"a":10},{"a":11}]}] | |
1093 | [{"count":1}] | |
1094 | [{"rows":[]}] | |
1095 | [{"uuid":["uuid","<13>"]}] | |
1096 | [{"rows":[]}] | |
bd76d25d | 1097 | ]])]) |
21ff1aee BP |
1098 | |
1099 | EXECUTION_EXAMPLES |