@@ -728,6 +728,53 @@ dnl collide (only) with their previous values (succeeds).
[{"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}]}]
]])
+OVSDB_CHECK_EXECUTION([size constraints on sets],
+ [constraint_schema],
+ [
+ [[["constraints",
+ {"op": "insert",
+ "table": "b",
+ "row": {"b": 1}
+ }]]],
+ [[["constraints",
+ {"op": "mutate",
+ "table": "b",
+ "where": [],
+ "mutations": [["x", "delete", 0]]
+ }]]],
+ [[["constraints",
+ {"op": "mutate",
+ "table": "b",
+ "where": [],
+ "mutations": [["x", "insert", 1]]
+ }]]],
+ [[["constraints",
+ {"op": "update",
+ "table": "b",
+ "where": [],
+ "row": {"x": ["set", [3, 4]]}
+ }]]],
+ [[["constraints",
+ {"op": "mutate",
+ "table": "b",
+ "where": [],
+ "mutations": [["x", "insert", 5]]
+ }]]],
+ [[["constraints",
+ {"op": "mutate",
+ "table": "b",
+ "where": [],
+ "mutations": [["x", "delete", 4], ["x", "insert", 5]]
+ }]]]
+ ],
+ [[[{"uuid":["uuid","<0>"]}]
+[{"details":"Attempted to store 0 elements in set of 1 to 2 integers.","error":"constraint violation"}]
+[{"count":1}]
+[{"count":1}]
+[{"details":"Attempted to store 3 elements in set of 1 to 2 integers.","error":"constraint violation"}]
+[{"count":1}]
+]])
+
OVSDB_CHECK_EXECUTION([referential integrity -- simple],
[constraint_schema],
[[[["constraints",
@@ -751,12 +798,6 @@ OVSDB_CHECK_EXECUTION([referential integrity -- simple],
{"op": "delete",
"table": "b",
"where": []}]]],
-dnl Check that "mutate" honors number-of-elements constraints on sets and maps.
- [[["constraints",
- {"op": "mutate",
- "table": "b",
- "where": [],
- "mutations": [["x", "delete", 0]]}]]],
[[["constraints",
{"op": "delete",
"table": "a",
@@ -783,7 +824,6 @@ dnl Check that "mutate" honors number-of-elements constraints on sets and maps.
"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"}]
-[{"details":"Attempted to store 0 elements in set of 1 to 2 integers.","error":"constraint violation"}]
[{"count":1}]
[{"count":1},{"details":"cannot delete b row <0> because of 2 remaining reference(s)","error":"referential integrity violation"}]
[{"count":1}]
@@ -26,6 +26,9 @@ m4_define([OVSDB_SERVER_SHUTDOWN2],
# If a given UUID appears more than once it is always replaced by the
# same marker.
#
+# Additionally, checks that records written to a database file can be
+# read back producing the same in-memory database content.
+#
# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
m4_define([OVSDB_CHECK_EXECUTION],
[AT_SETUP([$1])
@@ -33,12 +36,22 @@ m4_define([OVSDB_CHECK_EXECUTION],
$2 > schema
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
on_exit 'kill `cat *.pid`'
- AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile --remote=punix:socket db], [0], [ignore], [ignore])
+ AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile \
+ --remote=punix:socket db], [0], [ignore], [ignore])
m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [stdout], [ignore])
cat stdout >> output
])
AT_CHECK([uuidfilt output], [0], [$4], [ignore])
+
+ AT_CHECK([ovsdb-client dump unix:socket], [0], [stdout], [ignore])
+
+ OVSDB_SERVER_SHUTDOWN
+
+ AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile \
+ --remote=punix:socket db], [0], [ignore], [ignore])
+ OVS_WAIT_UNTIL([ovsdb-client dump unix:socket > dump2; diff stdout dump2])
+
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
Adding an extra check to one of the ovsdb execution cases that will verify that ovsdb-server is able to read back transactions previously written to a database file. And also adding new execution tests that cover previously discovered issues with size checks on sets. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> --- tests/ovsdb-execution.at | 54 ++++++++++++++++++++++++++++++++++------ tests/ovsdb-server.at | 15 ++++++++++- 2 files changed, 61 insertions(+), 8 deletions(-)