2009-11-04 15:11:44 -08:00
AT_BANNER([OVSDB -- execution])
m4_define([ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[{"name": "ordinals",
2009-11-04 15:11:44 -08:00
"tables": {
"ordinals": {
"columns": {
"number": {"type": "integer"},
2010-12-27 14:26:47 -08:00
"name": {"type": "string"}}}},
2011-02-08 15:23:33 -08:00
"version": "5.1.3",
"cksum": "12345678 9"}]])
2009-11-04 15:11:44 -08:00
2010-02-08 14:09:36 -08:00
m4_define([CONSTRAINT_SCHEMA],
[[{"name": "constraints",
"tables": {
2010-02-08 14:09:41 -08:00
"a": {
"columns": {
"a": {"type": "integer"},
"a2a": {"type": {"key": {"type": "uuid", "refTable": "a"},
"min": 0, "max": "unlimited"}},
"a2b": {"type": {"key": {"type": "uuid", "refTable": "b"},
"min": 0, "max": "unlimited"}}}},
"b": {
"columns": {
"b": {"type": "integer"},
"b2a": {"type": {"key": {"type": "uuid", "refTable": "a"},
"min": 0, "max": "unlimited"}},
"b2b": {"type": {"key": {"type": "uuid", "refTable": "b"},
"min": 0, "max": "unlimited"}}}},
2010-02-08 14:09:36 -08:00
"constrained": {
"columns": {
"positive": {"type": {"key": {"type": "integer",
2010-03-16 17:08:06 -07:00
"minInteger": 1}}}},
"maxRows": 1}}}]])
2010-02-08 14:09:36 -08:00
2010-03-15 15:41:54 -07:00
m4_define([WEAK_SCHEMA],
[[{"name": "weak",
"tables": {
"a": {
"columns": {
"a": {"type": "integer"},
"a2a": {"type": {"key": {"type": "uuid",
"refTable": "a",
"refType": "weak"},
"min": 0, "max": "unlimited"}},
"a2a1": {"type": {"key": {"type": "uuid",
"refTable": "a",
"refType": "weak"}}},
"a2b": {"type": {"key": {"type": "uuid",
"refTable": "b",
"refType": "weak"}}}}},
"b": {
"columns": {
"b": {"type": "integer"},
"b2a": {"type": {"key": {"type": "uuid",
"refTable": "a",
"refType": "weak"},
"min": 0, "max": "unlimited"}}}}}}]])
2009-11-16 15:13:00 -08:00
# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
#
# Runs "test-ovsdb execute" with the given SCHEMA and each of the
# TRANSACTIONS (which should be a quoted list of quoted strings).
#
# Checks that the overall output is OUTPUT, but UUIDs in the output
2009-11-04 15:11:44 -08:00
# are replaced by markers of the form <N> where N is a number. The
# first unique UUID is replaced by <0>, the next by <1>, and so on.
# If a given UUID appears more than once it is always replaced by the
# same marker.
2009-11-16 15:13:00 -08:00
#
# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
2009-11-04 15:11:44 -08:00
m4_define([OVSDB_CHECK_EXECUTION],
[AT_SETUP([$1])
2009-11-16 15:13:00 -08:00
AT_KEYWORDS([ovsdb execute execution positive $5])
2010-02-01 14:04:25 -08:00
AT_CHECK([test-ovsdb execute '$2' m4_foreach([txn], [$3], [ 'txn'])],
2009-11-16 15:13:00 -08:00
[0], [stdout], [])
AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [$4])
2009-11-04 15:11:44 -08:00
AT_CLEANUP])
2011-02-28 15:43:29 -08:00
OVSDB_CHECK_EXECUTION([uuid-name must be <id>],
[CONSTRAINT_SCHEMA],
[[[["constraints",
{"op": "insert",
"table": "a",
"row": {},
"uuid-name": "0"}]]]],
[[[{"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\"}"}]
]])
OVSDB_CHECK_EXECUTION([named-uuid must be <id>],
[CONSTRAINT_SCHEMA],
[[[["constraints",
{"op": "insert",
"table": "a",
"row": {"a2a": ["named-uuid", "0"]}}]]]],
[[[{"details":"named-uuid string is not a valid <id>","error":"syntax error","syntax":"[\"named-uuid\",\"0\"]"}]
]])
2009-11-16 15:13:00 -08:00
m4_define([EXECUTION_EXAMPLES], [
2010-02-12 11:13:24 -08:00
dnl At one point the "commit" code ignored new rows with all-default values,
dnl so this checks for that problem.
OVSDB_CHECK_EXECUTION([insert default row, query table],
[ORDINAL_SCHEMA],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
"row": {}}]]],
[[["ordinals",
{"op": "select",
"table": "ordinals",
"where": []}]]]],
[[[{"uuid":["uuid","<0>"]}]
[{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"","number":0}]}]
]])
2009-11-04 15:11:44 -08:00
OVSDB_CHECK_EXECUTION([insert row, query table],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"row": {"number": 0, "name": "zero"}}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "select",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"where": []}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]}]
[{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]}]
]])
OVSDB_CHECK_EXECUTION([insert rows, query by value],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"row": {"number": 0, "name": "zero"}}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"row": {"number": 1, "name": "one"}}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "select",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"where": [["name", "==", "zero"]]}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "select",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"where": [["name", "==", "one"]]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"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}]}]
]])
OVSDB_CHECK_EXECUTION([insert rows, query by named-uuid],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"},
"uuid-name": "first"},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"},
"uuid-name": "second"},
{"op": "select",
"table": "ordinals",
"where": [["_uuid", "==", ["named-uuid", "first"]]]},
{"op": "select",
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"where": [["_uuid", "==", ["named-uuid", "second"]]]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"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}]}]
]])
OVSDB_CHECK_EXECUTION([insert rows, update rows by value],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"},
2009-11-16 15:13:00 -08:00
"uuid-name": "first"}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 1, "name": "one"},
2009-11-16 15:13:00 -08:00
"uuid-name": "first"}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "update",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"where": [["name", "==", "zero"]],
2009-11-16 15:13:00 -08:00
"row": {"name": "nought"}}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "select",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"where": [],
2009-11-16 15:13:00 -08:00
"sort": ["number"]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]}]
[{"uuid":["uuid","<1>"]}]
[{"count":1}]
[{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"nought","number":0},{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}]
]])
2009-12-16 10:49:31 -08:00
OVSDB_CHECK_EXECUTION([insert rows, mutate rows],
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-12-16 10:49:31 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"},
"uuid-name": "first"}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "insert",
2009-12-16 10:49:31 -08:00
"table": "ordinals",
"row": {"number": 1, "name": "one"},
"uuid-name": "first"}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "mutate",
2009-12-16 10:49:31 -08:00
"table": "ordinals",
"where": [["name", "==", "zero"]],
"mutations": [["number", "+=", 2]]}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "select",
2009-12-16 10:49:31 -08:00
"table": "ordinals",
"where": [],
"sort": ["number"]}]]]],
[[[{"uuid":["uuid","<0>"]}]
[{"uuid":["uuid","<1>"]}]
[{"count":1}]
[{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<2>"],"name":"one","number":1},{"_uuid":["uuid","<0>"],"_version":["uuid","<3>"],"name":"zero","number":2}]}]
]])
2009-11-04 15:11:44 -08:00
OVSDB_CHECK_EXECUTION([insert rows, delete by named-uuid],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"},
"uuid-name": "first"},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"},
"uuid-name": "second"},
{"op": "delete",
"table": "ordinals",
"where": [["_uuid", "==", ["named-uuid", "first"]]]},
{"op": "select",
"table": "ordinals",
"where": [],
2009-11-16 15:13:00 -08:00
"columns": ["name","number"]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"count":1},{"rows":[{"name":"one","number":1}]}]
]])
OVSDB_CHECK_EXECUTION([insert rows, delete rows by value],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"},
2009-11-16 15:13:00 -08:00
"uuid-name": "first"}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 1, "name": "one"},
2009-11-16 15:13:00 -08:00
"uuid-name": "first"}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "delete",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"where": [["name", "==", "zero"]]}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "select",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"where": []}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]}]
[{"uuid":["uuid","<1>"]}]
[{"count":1}]
[{"rows":[{"_uuid":["uuid","<1>"],"_version":["uuid","<2>"],"name":"one","number":1}]}]
]])
OVSDB_CHECK_EXECUTION([insert rows, delete by (non-matching) value],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"},
2009-11-16 15:13:00 -08:00
"uuid-name": "first"}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 1, "name": "one"},
2009-11-16 15:13:00 -08:00
"uuid-name": "first"}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "delete",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
2009-11-16 15:13:00 -08:00
"where": [["name", "==", "nought"]]}]]],
2010-02-09 10:17:58 -08:00
[[["ordinals",
{"op": "select",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"where": [],
2009-11-16 15:13:00 -08:00
"sort": ["number"]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]}]
[{"uuid":["uuid","<1>"]}]
[{"count":0}]
[{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"zero","number":0},{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}]
]])
OVSDB_CHECK_EXECUTION([insert rows, delete all],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"},
"uuid-name": "first"},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"},
"uuid-name": "second"},
{"op": "delete",
"table": "ordinals",
"where": []},
{"op": "select",
"table": "ordinals",
"where": [],
2009-11-16 15:13:00 -08:00
"columns": ["name","number"]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"count":2},{"rows":[]}]
]])
OVSDB_CHECK_EXECUTION([insert row, query table, commit],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"}},
{"op": "select",
"table": "ordinals",
"where": []},
{"op": "commit",
2009-11-16 15:13:00 -08:00
"durable": false}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]},{}]
]])
OVSDB_CHECK_EXECUTION([insert row, query table, commit durably],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"}},
{"op": "select",
"table": "ordinals",
"where": []},
{"op": "commit",
2009-11-16 15:13:00 -08:00
"durable": true}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"zero","number":0}]},{}]
]])
OVSDB_CHECK_EXECUTION([equality wait with correct rows],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"}},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"}},
{"op": "wait",
"timeout": 0,
"table": "ordinals",
"where": [],
"columns": ["name", "number"],
"until": "==",
"rows": [{"name": "zero", "number": 0},
2009-11-16 15:13:00 -08:00
{"name": "one", "number": 1}]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}]
]])
OVSDB_CHECK_EXECUTION([equality wait with extra row],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"}},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"}},
{"op": "wait",
"timeout": 0,
"table": "ordinals",
"where": [],
"columns": ["name", "number"],
"until": "==",
"rows": [{"name": "zero", "number": 0},
{"name": "one", "number": 1},
2009-11-16 15:13:00 -08:00
{"name": "two", "number": 2}]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}]
]])
OVSDB_CHECK_EXECUTION([equality wait with missing row],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"}},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"}},
{"op": "wait",
"timeout": 0,
"table": "ordinals",
"where": [],
"columns": ["name", "number"],
"until": "==",
2009-11-16 15:13:00 -08:00
"rows": [{"name": "one", "number": 1}]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}]
]])
OVSDB_CHECK_EXECUTION([inequality wait with correct rows],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"}},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"}},
{"op": "wait",
"timeout": 0,
"table": "ordinals",
"where": [],
"columns": ["name", "number"],
"until": "!=",
"rows": [{"name": "zero", "number": 0},
2009-11-16 15:13:00 -08:00
{"name": "one", "number": 1}]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"details":"\"wait\" timed out","error":"timed out"}]
]])
OVSDB_CHECK_EXECUTION([inequality wait with extra row],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"}},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"}},
{"op": "wait",
"timeout": 0,
"table": "ordinals",
"where": [],
"columns": ["name", "number"],
"until": "!=",
"rows": [{"name": "zero", "number": 0},
{"name": "one", "number": 1},
2009-11-16 15:13:00 -08:00
{"name": "two", "number": 2}]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}]
]])
OVSDB_CHECK_EXECUTION([inequality wait with missing row],
2009-11-16 15:13:00 -08:00
[ORDINAL_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["ordinals",
{"op": "insert",
2009-11-04 15:11:44 -08:00
"table": "ordinals",
"row": {"number": 0, "name": "zero"}},
{"op": "insert",
"table": "ordinals",
"row": {"number": 1, "name": "one"}},
{"op": "wait",
"timeout": 0,
"table": "ordinals",
"where": [],
"columns": ["name", "number"],
"until": "!=",
2009-11-16 15:13:00 -08:00
"rows": [{"name": "one", "number": 1}]}]]]],
2009-11-04 15:11:44 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}]
]])
2010-02-08 14:09:36 -08:00
OVSDB_CHECK_EXECUTION([insert and update constraints],
[CONSTRAINT_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["constraints",
{"op": "insert",
2010-02-08 14:09:36 -08:00
"table": "constrained",
"row": {}}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "insert",
2010-02-08 14:09:36 -08:00
"table": "constrained",
"row": {"positive": -1}}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "update",
2010-02-08 14:09:36 -08:00
"table": "constrained",
"where": [],
2010-03-16 17:08:06 -07:00
"row": {"positive": -2}}]]],
[[["constraints",
{"op": "insert",
"table": "constrained",
"row": {"positive": 1}}]]],
[[["constraints",
{"op": "insert",
"table": "constrained",
"row": {"positive": 2}}]]]],
2010-02-08 14:09:36 -08:00
[[[{"details":"0 is less than minimum allowed value 1","error":"constraint violation"}]
[{"details":"-1 is less than minimum allowed value 1","error":"constraint violation"}]
[{"details":"-2 is less than minimum allowed value 1","error":"constraint violation"}]
2010-03-16 17:08:06 -07:00
[{"uuid":["uuid","<0>"]}]
[{"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"}]
2010-02-08 14:09:41 -08:00
]])
OVSDB_CHECK_EXECUTION([referential integrity -- simple],
[CONSTRAINT_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["constraints",
{"op": "insert",
2010-02-08 14:09:41 -08:00
"table": "b",
"row": {"b": 1},
"uuid-name": "brow"},
{"op": "insert",
"table": "a",
"row": {"a": 0,
"a2b": ["set", [["named-uuid", "brow"]]]}},
{"op": "insert",
"table": "a",
"row": {"a": 1,
"a2b": ["set", [["named-uuid", "brow"]]]}},
{"op": "insert",
"table": "a",
"row": {"a": 2,
"a2b": ["set", [["named-uuid", "brow"]]]}}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "b",
"where": []}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "a",
"where": [["a", "==", 0]]}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "b",
"where": []}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "a",
"where": [["a", "==", 1]]}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "b",
"where": []}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "a",
"where": [["a", "==", 2]]}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "b",
"where": []}]]]],
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]
[{"count":1},{"details":"cannot delete b row <0> because of 3 remaining reference(s)","error":"referential integrity violation"}]
[{"count":1}]
[{"count":1},{"details":"cannot delete b row <0> because of 2 remaining reference(s)","error":"referential integrity violation"}]
[{"count":1}]
[{"count":1},{"details":"cannot delete b row <0> because of 1 remaining reference(s)","error":"referential integrity violation"}]
[{"count":1}]
[{"count":1}]
]])
OVSDB_CHECK_EXECUTION([referential integrity -- mutual references],
[CONSTRAINT_SCHEMA],
2010-02-09 10:17:58 -08:00
[[[["constraints",
{"op": "insert",
2010-02-08 14:09:41 -08:00
"table": "a",
"row": {"a": 0,
"a2b": ["set", [["named-uuid", "row2"]]],
"a2a": ["set", [["named-uuid", "row1"]]]},
"uuid-name": "row1"},
{"op": "insert",
"table": "b",
"row": {"b": 1,
"b2b": ["set", [["named-uuid", "row2"]]],
"b2a": ["set", [["named-uuid", "row1"]]]},
"uuid-name": "row2"}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "insert",
2010-02-08 14:09:41 -08:00
"table": "a",
"row": {"a2b": ["set", [["uuid", "b516b960-5b19-4fc2-bb82-fe1cbd6d0241"]]]}}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "a",
"where": [["a", "==", 0]]}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "b",
"where": [["b", "==", 1]]}]]],
dnl Try the deletions again to make sure that the refcounts got rolled back.
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "a",
"where": [["a", "==", 0]]}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "b",
"where": [["b", "==", 1]]}]]],
2010-02-09 10:17:58 -08:00
[[["constraints",
{"op": "delete",
2010-02-08 14:09:41 -08:00
"table": "a",
"where": [["a", "==", 0]]},
{"op": "delete",
"table": "b",
"where": [["b", "==", 1]]}]]]],
2010-02-08 16:03:21 -08:00
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]
2010-06-11 13:56:36 -07:00
[{"uuid":["uuid","<2>"]},{"details":"Table a column a2b row <2> references nonexistent row <3> in table b.","error":"referential integrity violation"}]
2010-02-08 14:09:41 -08:00
[{"count":1},{"details":"cannot delete a row <0> because of 1 remaining reference(s)","error":"referential integrity violation"}]
[{"count":1},{"details":"cannot delete b row <1> because of 1 remaining reference(s)","error":"referential integrity violation"}]
[{"count":1},{"details":"cannot delete a row <0> because of 1 remaining reference(s)","error":"referential integrity violation"}]
[{"count":1},{"details":"cannot delete b row <1> because of 1 remaining reference(s)","error":"referential integrity violation"}]
[{"count":1},{"count":1}]
2010-03-15 15:41:54 -07:00
]])
OVSDB_CHECK_EXECUTION([weak references],
[WEAK_SCHEMA],
[[[["weak",
{"op": "insert",
"table": "a",
"row": {"a": 0,
"a2a": ["set", [["named-uuid", "row1"],
["named-uuid", "row2"],
["uuid", "0e767b36-6822-4044-8307-d58467e04669"]]],
"a2a1": ["named-uuid", "row1"],
"a2b": ["named-uuid", "row3"]},
"uuid-name": "row1"},
{"op": "insert",
"table": "a",
"row": {"a": 1,
"a2a": ["set", [["named-uuid", "row1"],
["named-uuid", "row2"]]],
"a2a1": ["named-uuid", "row2"],
"a2b": ["named-uuid", "row3"]},
"uuid-name": "row2"},
{"op": "insert",
"table": "a",
"row": {"a": 2,
"a2a": ["set", [["named-uuid", "row1"],
["named-uuid", "row2"]]],
"a2a1": ["named-uuid", "row2"],
"a2b": ["named-uuid", "row4"]}},
{"op": "insert",
"table": "b",
"row": {"b": 2,
"b2a": ["named-uuid", "row1"]},
"uuid-name": "row3"},
{"op": "insert",
"table": "b",
"row": {"b": 3,
"b2a": ["named-uuid", "row2"]},
"uuid-name": "row4"}]]],
dnl Check that the nonexistent row UUID we added to row a0 was deleted,
dnl and that other rows were inserted as requested.
[[["weak",
{"op": "select",
"table": "a",
"where": [],
"columns": ["_uuid", "a2a", "a2a1", "a2b"],
"sort": ["a"]}]]],
[[["weak",
{"op": "select",
"table": "b",
"where": [],
"columns": ["_uuid", "b", "b2a"],
"sort": ["b"]}]]],
dnl Try to insert invalid all-zeros weak reference (the default) into
dnl "a2b", which requires exactly one value.
[[["weak",
{"op": "insert",
"table": "a",
2010-05-07 10:38:13 -07:00
"row": {"a2a1": ["named-uuid", "me"]},
"uuid-name": "me"}]]],
2010-03-15 15:41:54 -07:00
dnl Try to delete row from "b" that is referred to by weak references
dnl from "a" table "a2b" column that requires exactly one value.
[[["weak",
{"op": "delete",
"table": "b",
"where": [["b", "==", 3]]}]]],
dnl Try to delete row from "a" that is referred to by weak references
dnl from "a" table "a2a1" column that requires exactly one value.
[[["weak",
{"op": "delete",
"table": "a",
"where": [["a", "==", 1]]}]]],
dnl Delete the row that had the reference that caused the previous
dnl deletion to fail, then check that other rows are unchanged.
[[["weak",
{"op": "delete",
"table": "a",
"where": [["a", "==", 2]]}]]],
[[["weak",
{"op": "select",
"table": "a",
"where": [],
"columns": ["_uuid", "a2a", "a2a1", "a2b"],
"sort": ["a"]}]]],
[[["weak",
{"op": "select",
"table": "b",
"where": [],
"columns": ["_uuid", "b", "b2a"],
"sort": ["b"]}]]],
dnl Delete row a0 then check that references to it were removed.
[[["weak",
{"op": "delete",
"table": "a",
"where": [["a", "==", 0]]}]]],
[[["weak",
{"op": "select",
"table": "a",
"where": [],
"columns": ["_uuid", "a2a", "a2a1", "a2b"],
"sort": ["a"]}]]],
[[["weak",
{"op": "select",
"table": "b",
"where": [],
"columns": ["_uuid", "b", "b2a"],
"sort": ["b"]}]]],
dnl Delete row a1 then check that references to it were removed.
[[["weak",
{"op": "delete",
"table": "a",
"where": [["a", "==", 1]]}]]],
[[["weak",
{"op": "select",
"table": "a",
"where": [],
"columns": ["_uuid", "a2a", "a2a1", "a2b"],
"sort": ["a"]}]]],
[[["weak",
{"op": "select",
"table": "b",
"where": [],
"columns": ["_uuid", "b", "b2a"],
"sort": ["b"]}]]]],
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]},{"uuid":["uuid","<4>"]}]
[{"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>"]}]}]
[{"rows":[{"_uuid":["uuid","<3>"],"b":2,"b2a":["uuid","<0>"]},{"_uuid":["uuid","<4>"],"b":3,"b2a":["uuid","<1>"]}]}]
[{"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"}]
[{"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"}]
[{"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"}]
[{"count":1}]
[{"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>"]}]}]
[{"rows":[{"_uuid":["uuid","<3>"],"b":2,"b2a":["uuid","<0>"]},{"_uuid":["uuid","<4>"],"b":3,"b2a":["uuid","<1>"]}]}]
[{"count":1}]
[{"rows":[{"_uuid":["uuid","<1>"],"a2a":["uuid","<1>"],"a2a1":["uuid","<1>"],"a2b":["uuid","<3>"]}]}]
[{"rows":[{"_uuid":["uuid","<3>"],"b":2,"b2a":["set",[]]},{"_uuid":["uuid","<4>"],"b":3,"b2a":["uuid","<1>"]}]}]
[{"count":1}]
[{"rows":[]}]
[{"rows":[{"_uuid":["uuid","<3>"],"b":2,"b2a":["set",[]]},{"_uuid":["uuid","<4>"],"b":3,"b2a":["set",[]]}]}]
2010-02-08 14:09:36 -08:00
]])])
2009-11-16 15:13:00 -08:00
EXECUTION_EXAMPLES