[ovs-dev] [PATCH] [RFC] ovsdb-server: Allow OVSDB clients to specify the UUID for inserted rows.
Ben Pfaff
blp at ovn.org
Thu Jan 9 20:45:59 UTC 2020
On Thu, Jan 09, 2020 at 02:21:18PM -0500, Flavio Fernandes wrote:
> This looks good to me, but I wonder if it would be a good idea to also
> add a test where we exercise the failure expected when trying to
> insert with a duplicate uuid. What do you think?
That is a good idea. We can do it within the same test. Here is an
incremental. I will post a v2.
diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at
index 10472d76fcbe..e72bf0606978 100644
--- a/tests/ovsdb-execution.at
+++ b/tests/ovsdb-execution.at
@@ -251,17 +251,26 @@ OVSDB_CHECK_EXECUTION([insert row, query table],
OVSDB_CHECK_EXECUTION([insert row with uuid, query table],
[ordinal_schema],
+dnl Insert initial row.
[[[["ordinals",
{"op": "insert",
"uuid": "ffffffff-971b-4cba-bf42-520515973b7e",
"table": "ordinals",
"row": {"number": 0, "name": "zero"}}]]],
+dnl Query row back.
[[["ordinals",
{"op": "select",
"table": "ordinals",
- "where": []}]]]],
+ "where": []}]]],
+dnl Attempt to insert second row with same UUID (fails).
+ [[["ordinals",
+ {"op": "insert",
+ "uuid": "ffffffff-971b-4cba-bf42-520515973b7e",
+ "table": "ordinals",
+ "row": {"number": 0, "name": "zero"}}]]]],
[[[{"uuid":["uuid","ffffffff-971b-4cba-bf42-520515973b7e"]}]
[{"rows":[{"_uuid":["uuid","ffffffff-971b-4cba-bf42-520515973b7e"],"_version":["uuid","<0>"],"name":"zero","number":0}]}]
+[{"details":"This UUID would duplicate a UUID already present within the table or deleted within the same transaction.","error":"duplicate uuid","syntax":"\"ffffffff-971b-4cba-bf42-520515973b7e\""}]
]])
OVSDB_CHECK_EXECUTION([insert rows, query by value],
More information about the dev
mailing list