summaryrefslogtreecommitdiff
path: root/tests/ovsdb-execution.at
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-02-08 14:09:36 -0800
committerBen Pfaff <blp@nicira.com>2010-02-08 14:16:19 -0800
commitbd76d25d8b3b7d11c5a326e91d784ad2cdeecd45 (patch)
tree688e7370f9794e3c4189c38ff38a59937c9016e1 /tests/ovsdb-execution.at
parent629cd2f17fedf8d922f61ffd13365d1f4f9b34fe (diff)
downloadopenvswitch-bd76d25d8b3b7d11c5a326e91d784ad2cdeecd45.tar.gz
ovsdb: Add simple constraints.
Diffstat (limited to 'tests/ovsdb-execution.at')
-rw-r--r--tests/ovsdb-execution.at26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at
index 1113f948e..bb9d6cf43 100644
--- a/tests/ovsdb-execution.at
+++ b/tests/ovsdb-execution.at
@@ -8,6 +8,14 @@ m4_define([ORDINAL_SCHEMA],
"number": {"type": "integer"},
"name": {"type": "string"}}}}}]])
+m4_define([CONSTRAINT_SCHEMA],
+ [[{"name": "constraints",
+ "tables": {
+ "constrained": {
+ "columns": {
+ "positive": {"type": {"key": {"type": "integer",
+ "minInteger": 1}}}}}}}]])
+
# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
#
# Runs "test-ovsdb execute" with the given SCHEMA and each of the
@@ -352,6 +360,22 @@ OVSDB_CHECK_EXECUTION([inequality wait with missing row],
"rows": [{"name": "one", "number": 1}]}]]]],
[[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{}]
]])
-])
+
+OVSDB_CHECK_EXECUTION([insert and update constraints],
+ [CONSTRAINT_SCHEMA],
+ [[[[{"op": "insert",
+ "table": "constrained",
+ "row": {}}]]],
+ [[[{"op": "insert",
+ "table": "constrained",
+ "row": {"positive": -1}}]]],
+ [[[{"op": "update",
+ "table": "constrained",
+ "where": [],
+ "row": {"positive": -2}}]]]],
+ [[[{"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"}]
+]])])
EXECUTION_EXAMPLES