1 AT_BANNER([OVSDB -- execution])
3 m4_define([ORDINAL_SCHEMA],
8 "number": {"type": "integer"},
9 "name": {"type": "string"}}}}}]])
11 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
13 # Runs "test-ovsdb execute" with the given SCHEMA and each of the
14 # TRANSACTIONS (which should be a quoted list of quoted strings).
16 # Checks that the overall output is OUTPUT, but UUIDs in the output
17 # are replaced by markers of the form <N> where N is a number. The
18 # first unique UUID is replaced by <0>, the next by <1>, and so on.
19 # If a given UUID appears more than once it is always replaced by the
22 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
23 m4_define([OVSDB_CHECK_EXECUTION],
25 AT_KEYWORDS([ovsdb execute execution positive $5])
26 AT_CHECK([test-ovsdb execute '$2' m4_foreach([txn], [$3], [ 'txn'])],
28 AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [$4])
31 m4_define([EXECUTION_EXAMPLES], [
32 OVSDB_CHECK_EXECUTION([insert row, query table],
36 "row": {"number": 0, "name": "zero"}}]]],
40 [[[{"uuid":["uuid","<0>"]}]
41 [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]}]
44 OVSDB_CHECK_EXECUTION([insert rows, query by value],
48 "row": {"number": 0, "name": "zero"}}]]],
51 "row": {"number": 1, "name": "one"}}]]],
54 "where": [["name", "==", "zero"]]}]]],
57 "where": [["name", "==", "one"]]}]]]],
58 [[[{"uuid":["uuid","<0>"]}]
59 [{"uuid":["uuid","<1>"]}]
60 [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"zero","number":0}]}]
61 [{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}]
64 OVSDB_CHECK_EXECUTION([insert rows, query by named-uuid],
68 "row": {"number": 0, "name": "zero"},
69 "uuid-name": "first"},
72 "row": {"number": 1, "name": "one"},
73 "uuid-name": "second"},
76 "where": [["_uuid", "==", ["named-uuid", "first"]]]},
79 "where": [["_uuid", "==", ["named-uuid", "second"]]]}]]]],
80 [[[{"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}]}]
83 OVSDB_CHECK_EXECUTION([insert rows, update rows by value],
87 "row": {"number": 0, "name": "zero"},
88 "uuid-name": "first"}]]],
91 "row": {"number": 1, "name": "one"},
92 "uuid-name": "first"}]]],
95 "where": [["name", "==", "zero"]],
96 "row": {"name": "nought"}}]]],
100 "sort": ["number"]}]]]],
101 [[[{"uuid":["uuid","<0>"]}]
102 [{"uuid":["uuid","<1>"]}]
104 [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"nought","number":0},{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}]
107 OVSDB_CHECK_EXECUTION([insert rows, mutate rows],
111 "row": {"number": 0, "name": "zero"},
112 "uuid-name": "first"}]]],
115 "row": {"number": 1, "name": "one"},
116 "uuid-name": "first"}]]],
119 "where": [["name", "==", "zero"]],
120 "mutations": [["number", "+=", 2]]}]]],
124 "sort": ["number"]}]]]],
125 [[[{"uuid":["uuid","<0>"]}]
126 [{"uuid":["uuid","<1>"]}]
128 [{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<2>"],"name":"one","number":1},{"_uuid":["uuid","<0>"],"_version":["uuid","<3>"],"name":"zero","number":2}]}]
131 OVSDB_CHECK_EXECUTION([insert rows, delete by named-uuid],
135 "row": {"number": 0, "name": "zero"},
136 "uuid-name": "first"},
139 "row": {"number": 1, "name": "one"},
140 "uuid-name": "second"},
143 "where": [["_uuid", "==", ["named-uuid", "first"]]]},
147 "columns": ["name","number"]}]]]],
148 [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"count":1},{"rows":[{"name":"one","number":1}]}]
151 OVSDB_CHECK_EXECUTION([insert rows, delete rows by value],
155 "row": {"number": 0, "name": "zero"},
156 "uuid-name": "first"}]]],
159 "row": {"number": 1, "name": "one"},
160 "uuid-name": "first"}]]],
163 "where": [["name", "==", "zero"]]}]]],
167 [[[{"uuid":["uuid","<0>"]}]
168 [{"uuid":["uuid","<1>"]}]
170 [{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<2>"],"name":"one","number":1}]}]
173 OVSDB_CHECK_EXECUTION([insert rows, delete by (non-matching) value],
177 "row": {"number": 0, "name": "zero"},
178 "uuid-name": "first"}]]],
181 "row": {"number": 1, "name": "one"},
182 "uuid-name": "first"}]]],
185 "where": [["name", "==", "nought"]]}]]],
189 "sort": ["number"]}]]]],
190 [[[{"uuid":["uuid","<0>"]}]
191 [{"uuid":["uuid","<1>"]}]
193 [{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"zero","number":0},{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}]
196 OVSDB_CHECK_EXECUTION([insert rows, delete all],
200 "row": {"number": 0, "name": "zero"},
201 "uuid-name": "first"},
204 "row": {"number": 1, "name": "one"},
205 "uuid-name": "second"},
212 "columns": ["name","number"]}]]]],
213 [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"count":2},{"rows":[]}]
216 OVSDB_CHECK_EXECUTION([insert row, query table, commit],
220 "row": {"number": 0, "name": "zero"}},
225 "durable": false}]]]],
226 [[[{"uuid":["uuid","<0>"]},{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]},{}]
229 OVSDB_CHECK_EXECUTION([insert row, query table, commit durably],
233 "row": {"number": 0, "name": "zero"}},
238 "durable": true}]]]],
239 [[[{"uuid":["uuid","<0>"]},{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]},{}]
242 OVSDB_CHECK_EXECUTION([equality wait with correct rows],
246 "row": {"number": 0, "name": "zero"}},
249 "row": {"number": 1, "name": "one"}},
254 "columns": ["name", "number"],
256 "rows": [{"name": "zero", "number": 0},
257 {"name": "one", "number": 1}]}]]]],
258 [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}]
261 OVSDB_CHECK_EXECUTION([equality wait with extra row],
265 "row": {"number": 0, "name": "zero"}},
268 "row": {"number": 1, "name": "one"}},
273 "columns": ["name", "number"],
275 "rows": [{"name": "zero", "number": 0},
276 {"name": "one", "number": 1},
277 {"name": "two", "number": 2}]}]]]],
278 [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}]
281 OVSDB_CHECK_EXECUTION([equality wait with missing row],
285 "row": {"number": 0, "name": "zero"}},
288 "row": {"number": 1, "name": "one"}},
293 "columns": ["name", "number"],
295 "rows": [{"name": "one", "number": 1}]}]]]],
296 [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}]
299 OVSDB_CHECK_EXECUTION([inequality wait with correct rows],
303 "row": {"number": 0, "name": "zero"}},
306 "row": {"number": 1, "name": "one"}},
311 "columns": ["name", "number"],
313 "rows": [{"name": "zero", "number": 0},
314 {"name": "one", "number": 1}]}]]]],
315 [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}]
318 OVSDB_CHECK_EXECUTION([inequality wait with extra row],
322 "row": {"number": 0, "name": "zero"}},
325 "row": {"number": 1, "name": "one"}},
330 "columns": ["name", "number"],
332 "rows": [{"name": "zero", "number": 0},
333 {"name": "one", "number": 1},
334 {"name": "two", "number": 2}]}]]]],
335 [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}]
338 OVSDB_CHECK_EXECUTION([inequality wait with missing row],
342 "row": {"number": 0, "name": "zero"}},
345 "row": {"number": 1, "name": "one"}},
350 "columns": ["name", "number"],
352 "rows": [{"name": "one", "number": 1}]}]]]],
353 [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}]